Open martinpugdal opened 3 years ago
sadly its not so straight forward, cause its kinda expected that you do this interactively, I am not sure if MSA has flows enabled that allow username password authentication like that. see https://wiki.vg/Microsoft_Authentication_Scheme
edit: seems like I am wrong, prismarine is able to use device code flows https://github.com/PrismarineJS/node-minecraft-protocol/blob/master/src/client/microsoftAuth.js
Actually PrismarineJS doesn't use the device code flow by default, it only does if it can't authenticate on Xbox live with a username / password
Over the last few days I've been developing a custom Minecraft proxy and I needed Microsoft auth for someone, so I tried to implement it. So here is my python implementation of the xbox live auth: https://github.com/TheStaticTurtle/MineProxy/blob/master/networking/McAuth/MicrosoftAuth.py It's based on PrismarineJS and the xbox-live-auth module, and it seems to work for the person that I wrote it for, but it might have some bugs still
Actually, my implementation is somewhat compatible with the one of pyCraft, so it might work right away (provided that you only call authenticate and join_server)
Actually PrismarineJS doesn't use the device code flow by default, it only does if it can't authenticate on Xbox live with a username / password
Over the last few days I've been developing a custom Minecraft proxy and I needed Microsoft auth for someone, so I tried to implement it. So here is my python implementation of the xbox live auth: https://github.com/TheStaticTurtle/MineProxy/blob/master/networking/McAuth/MicrosoftAuth.py It's based on PrismarineJS and the xbox-live-auth module, and it seems to work for the person that I wrote it for, but it might have some bugs still
Actually, my implementation is somewhat compatible with the one of pyCraft, so it might work right away (provided that you only call authenticate and join_server)
Hmmm, so how can I use that, because I tried a lot stuff with your implementation and I can't get that to work. Can you maybe make an example to use that with pycraft?
Actually, I meant compatible as in "doesn't need to rewrite everything that uses the auth_token variable", my token classes use pretty much the same functions as the current one, so it might work, but I'm not sure how seamless it would be
That said, if something were to work, it would look something like this:
auth_token= MicrosoftAuthenticationToken()
auth_token.authenticate("email", "password")
connection = Connection("127.0.0.1", 25565, auth_token=auth_token)
...
Just for context, I don't actually know how to use pycraft even tho I read a lot of its code for my project, so there might be something I missed.
I have a similar process that gets the bearer token (drawback is that it ofc doesn't support 2FA enabled accounts). It's in rust but it should be easy enough to understand. https://github.com/tropicbliss/xboxlive-auth/blob/main/src/xbox.rs
I made it on Python! Just change a little for it microsoft_login.py
I made it on Python! Just change a little for it microsoft_login.py
Links not working. Anyone else has any clue about the Microsoft Login situation?
Links not working. Anyone else has any clue about the Microsoft Login situation?
If you are still struggling you can use helper/Auth.py as an example on how to implement it using a local http server and your default webbrowser.
get_auth_code
gets the auth_code
which you then can pass to authenticate
which then returns the auth_token
which can be passed to Connection
.
The reason I implemented it in two steps was that a server for which one only has console access does not provide a default browser. See README#server.
And as the usual you need an Azure App for this to work to begin with. See README#microsoft-login.
I made it on Python! Just change a little for it microsoft_login.py
Links not working. Anyone else has any clue about the Microsoft Login situation?
You need register a toke. For more information, See wiki.vg
I made it on Python! Just change a little for it microsoft_login.py
404?
@martinersej #253 U can add this code to ur authentication.py
Then u can
I think u need to update ur authentication.py file to get microsoft accounts to work with that. U can example do that
authentication.AuthenticationToken().authenticate(username, password, microsoft_account=True)
.