Skip to content
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

Microsoft account log in #106

Closed
maxsupermanhd opened this issue Jul 25, 2021 · 14 comments
Closed

Microsoft account log in #106

maxsupermanhd opened this issue Jul 25, 2021 · 14 comments
Labels
enhancement New feature or request

Comments

@maxsupermanhd
Copy link
Contributor

I assume Yggdrasil authentication system can not log in with Microsoft credentials since it failed for me, is there a way to authenticate with migrated account?

@Tnze
Copy link
Owner

Tnze commented Jul 26, 2021

By following this guide you can get the mc access token which is called AsTk in go-mc, the username and the uuid. Then fill these into your client.Auth.

The progress is not provided by go-mc. Because it involves calling browser and handling redirect. And the user of go-mc should chose the appropriate implement scheme as needed.

@maxsupermanhd
Copy link
Contributor Author

Yeah, thank you so much, having to implement or use web view for this things is so wrong however people at mineflayer made a very interesting thing, they are showing you some kind of an authorization code to enter on a microsoft website that allow them to proceed a log in. It looks like an easy thing to implement too, no need to even touch client credentials - just prompt to log in via browser.

@Tnze
Copy link
Owner

Tnze commented Jul 27, 2021

That could be a good idea. Just like we do half of works and expose the interface of browser things.

However Microsoft is making a great improve of security, the author of third-party launcher never hold the user's password and collect it in the dark - either browser or web view is a black-box for most developer.

@maxsupermanhd
Copy link
Contributor Author

maxsupermanhd commented Jul 27, 2021

So I spent few (6) hours and designed web-view based authentication scheme, should I open PR or you will just take a look and decide? This authorization hell indeed require window so I created one with https://github.com/webview/webview but it can not close because of issue 588 however it is fully functional and I even joined multiplayer server. Have no idea how this passing to browser works but regardless - it is really complex and there is no shortcuts: Microsoft, XBL, XSTS, MC and profile.

P.S. I don't actually care about it implementing here, I did it inside my other project just for myself. I will invite you to repo for you to check out if you decide.

@maxsupermanhd
Copy link
Contributor Author

Also, it is not a black box, in my implementation I cache Microsoft authorization forever since I got token and refresh token. Sure credentials will be not touched (can be still sniffed with js injection tho) but token is something you can not revoke easily when with credentials you are just changing password or whatever (2fa is for masterminds I suppose at this point (I have it on my Microsoft account and suggest everyone else))

@Tnze
Copy link
Owner

Tnze commented Jul 27, 2021

But can you send your token to another device (for example, the IP address is changed) and keep it works good?

@maxsupermanhd
Copy link
Contributor Author

But can you send your token to another device (for example, the IP address is changed) and keep it works good?

Yes it does.

@Tnze
Copy link
Owner

Tnze commented Jul 27, 2021

I'll check it tomorrow.

@Tnze Tnze added the enhancement New feature or request label Jul 27, 2021
@Tnze
Copy link
Owner

Tnze commented Jul 28, 2021

Can I use BSD library (golang.org/x/oauth2) in MIT project?

@spbinns
Copy link
Contributor

spbinns commented Jul 28, 2021

@maxsupermanhd
Copy link
Contributor Author

Also for some reason I was completely blind, it is called device authorization flow and it is very similar to what I have now, just replaces browser with redirect for a pooling of url with code with a bit of a logic. Should I implement it and open PR or you will take it a try by yourself?

@Tnze
Copy link
Owner

Tnze commented Jul 29, 2021

I would like to have a try.

@maxsupermanhd
Copy link
Contributor Author

Well, I was impatient https://github.com/maxsupermanhd/go-mc-ms-auth

@Tnze
Copy link
Owner

Tnze commented Jul 31, 2021

That's cool. You can link to your lib from my readme so that others can know.

Then I'll give up implementing this in go-mc. Just give me the Name, UUID and AsTk, and then it will works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants