C
C#2y ago
Riles

❔ Log into minecraft with xbox/microsoft api

I was wondering how to authenticate a Minecraft account with Microsofts new account system and if there's a NUget package that could help
22 Replies
jcotton42
jcotton422y ago
@a_seal https://wiki.vg/ is your friend for this kind of stuff there's a page on authentication
Riles
RilesOP2y ago
Thanks
Riles
RilesOP2y ago
I'm here on the wiki: https://wiki.vg/Microsoft_Authentication_Scheme I created an application with microsoft azure but I have no idea what to do with this oauth2 authorization code flow
JakenVeina
JakenVeina2y ago
what kind of app are you building?
Riles
RilesOP2y ago
A launcher
JakenVeina
JakenVeina2y ago
well, as the article mentions, it's all predicated on the idea of browser redirects so, if you're going to use code flow, you have to be able to launch a browser AS WELL AS receive a callback which means having an HTTP server, at least temporarily, as the article also mentions otherwise, there's an alternative "device code flow" both still require the user to visit Microsoft's website, in a browser, which is the core point of how OAuth works users don't authenticate themselves to you, they authenticate themselves to Microsoft, or whoever the OAuth provider is and then the provider confirms it for you
Riles
RilesOP2y ago
Is this why i need to make a azure app
JakenVeina
JakenVeina2y ago
yes
Riles
RilesOP2y ago
ahh
JakenVeina
JakenVeina2y ago
you have to tell Microsoft ahead of time that you intend to use its OAuth services for your app A) that gives them some amount of traceability for who's using their shit B) that makes you declare up-front what you're intending to use OAuth for, I.E. what permissions you need, which then gets passed on to the user for them to confirm whether it's okay C) that gives them the ability to immediately revoke your ability to use the OAuth system, in the event of a security breach or something, in the form of revoking your API key D) that gives you the same ability to "shut down" the app by revoking the API key
Riles
RilesOP2y ago
this thing:
JakenVeina
JakenVeina2y ago
yup that's Microsoft's website users give their password or whatever to Microsoft never to you ergo, they don't HAVE to trust that you're not doing anything nefarious with it, cause you never have the chance
Riles
RilesOP2y ago
so the app gets an access token in the end, is that what I receive in order to log the players in?
JakenVeina
JakenVeina2y ago
yes you get an access token in response to their login that access token allows you to access other Microsoft/Minecraft services, at least temporarily in your case, perhaps the only thing you need is to identify the user like, maybe call a GetUserInfo endpoint or maybe you need to retrieve like a session token to pass to the game when you launch it
Riles
RilesOP2y ago
ye, how do I get the link for the OAuth that player put their credentials into
JakenVeina
JakenVeina2y ago
you'll have to check documentation ideally, you'll retrieve it from Microsoft on the fly
Riles
RilesOP2y ago
k thx
JakenVeina
JakenVeina2y ago
one of the standards for doing all of this is the OpenIDConnect protocol
jcotton42
jcotton422y ago
that wiki.vg page tells you everything you need to know
JakenVeina
JakenVeina2y ago
for which, the URL you retrieve all the info from is https://{oauth-provider-hostname}/.well-known/openid-configuration
Buddy
Buddy2y ago
Why are so many doing launchers nowadays? I see it all the time here.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server