-
-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate Authentication for Microsoft Accounts #788
Conversation
if options.auth === 'microsoft' then use microsoft/xbox auth, else use Yggdrasil until they kill that.
Technically this will always be true so...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Does it work ? Does it fake the browser ? |
It works, valid session and everything. Any requests to minecraftservices.com uses a simple user-agent, requests made to Xbox Live uses this User-Agent: 2FA is not supported with this method as it causes authentication issues, however this can be used to temporarily support it until a better solution is found. |
|
Yes, basically add the auth option in API.md, and a simple example is useful in the examples folder |
Thanks, that's great. |
LGTM, we probably want to support the json storage here too, but this can be done in another PR |
Afaik, we do not have enough information to support the |
What information are we missing ? Can't we store the tokens ? |
* add node-fetch and @xboxreplay/xboxlive-auth for microsoft/xbox auth * decide which authentication to use based on options; if options.auth === 'microsoft' then use microsoft/xbox auth, else use Yggdrasil until they kill that. * push working auth * commentary * eslint does not like me :( * User-Agent works just fine without version * linting = 95% of development * revert changes to encrypt.js * set haveCredentials to whether or not we have a token. Technically this will always be true so...? * eslint * mod+create: api + example * mod: readme.md
Is there a way to use an already valid access token to authenticate the user? I have a web dashboard where I'm logging in using Microsoft Oauth with the XboxLive.signin scope. I want to use the access_token from there to create a minecraft client in the backend. That's why just using the already existing token, instead of using https://www.microsoft.com/link would be awesome. EDIT: found your discord server and posted the question there as well. not sure if comments on three year old PR still get noticed |
Afaik its been done, you just need to provide your own auth factory. Theres been some mentions in the discord on how to do this. |
As far as I understood browsing through the code doing the authentication flows normally I would need to fork prismarine-auth, since the flows are defined there right? |
The auth flow allows you to use a function instead of a caching location, allowing you to use external means of authentication. You can just replicate the data that prismarine-auth generates and store it like that. You can also try switching the auth provider to the old Yggdrasil one, setting all of the session data required and then setting the bot to offline mode. I haven't tried that in a bit however.
I would honestly save that token into a database that can be fetched using a cacheFactory like I posted a link of an example. It would make it easier. |
Aight thanks. Imma look into that later |
This pull request adds two new npm modules:
@xboxreplay/xboxlive-auth
andnode-fetch
This integrates logging into Minecraft Servers for Microsoft Accounts.
In order to log into a server using a microsoft account, you must specify options.auth = 'microsoft';
This fixes:
#782
PrismarineJS/mineflayer#1480
// todo: clean up code just a little bit more.