<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.sasgaming.net/index.php?action=history&amp;feed=atom&amp;title=Minecraft%3AMicrosoft_authentication</id>
	<title>Minecraft:Microsoft authentication - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.sasgaming.net/index.php?action=history&amp;feed=atom&amp;title=Minecraft%3AMicrosoft_authentication"/>
	<link rel="alternate" type="text/html" href="https://wiki.sasgaming.net/index.php?title=Minecraft:Microsoft_authentication&amp;action=history"/>
	<updated>2026-06-10T13:04:47Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://wiki.sasgaming.net/index.php?title=Minecraft:Microsoft_authentication&amp;diff=108916&amp;oldid=prev</id>
		<title>SyncBot: Sync: new page from Minecraft</title>
		<link rel="alternate" type="text/html" href="https://wiki.sasgaming.net/index.php?title=Minecraft:Microsoft_authentication&amp;diff=108916&amp;oldid=prev"/>
		<updated>2026-05-10T11:15:11Z</updated>

		<summary type="html">&lt;p&gt;Sync: new page from Minecraft&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{for|API documentation|Mojang API}}&lt;br /&gt;
&lt;br /&gt;
[[Minecraft:Minecraft (franchise)|&amp;#039;&amp;#039;Minecraft&amp;#039;&amp;#039; games]] use &amp;#039;&amp;#039;&amp;#039;Microsoft accounts&amp;#039;&amp;#039;&amp;#039; for &amp;#039;&amp;#039;&amp;#039;authentication&amp;#039;&amp;#039;&amp;#039;. There are multiple steps and different tokens required, but in the end, a normal &amp;#039;&amp;#039;Minecraft&amp;#039;&amp;#039; token will be received. Launching the game itself hasn&amp;#039;t changed. All accounts now use this new system.&lt;br /&gt;
&lt;br /&gt;
== Microsoft OAuth2 flow ==&lt;br /&gt;
Prior to any of these steps, you will first need to obtain an OAuth 2.0 client ID by [https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app creating a Microsoft Azure application]. You will &amp;#039;&amp;#039;not&amp;#039;&amp;#039; need to obtain a client secret.&lt;br /&gt;
&lt;br /&gt;
You can then use the [https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow OAuth2 authorization code flow] to obtain an access token. You&amp;#039;ll need to present the user with a login page that, once completed, will redirect to a specified URL with the token in the query parameters. In non-web applications this typically involves spinning up a temporary HTTP server to handle the redirect. If you&amp;#039;d rather not do that, consider using the (slightly less automatic) [https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-device-code device code flow] instead.&lt;br /&gt;
&lt;br /&gt;
In any case, you&amp;#039;ll need to include &amp;lt;code&amp;gt;XboxLive.signin&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;scope&amp;lt;/code&amp;gt; parameter of the authorization request; otherwise the next endpoint will complain, and not in a helpful way.&lt;br /&gt;
&lt;br /&gt;
According  to [https://help.minecraft.net/hc/en-us/articles/16254801392141p this support Article], new created Azure Apps must apply for the Permission to use the Minecraft API using [https://aka.ms/mce-reviewappid this form]. If your App don&amp;#039;t have the Permission &amp;lt;code&amp;gt;api.minecraftservices.com&amp;lt;/code&amp;gt; will return a 403.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;Note: You &amp;lt;b&amp;gt;must&amp;lt;/b&amp;gt; use the &amp;lt;code&amp;gt;consumers&amp;lt;/code&amp;gt; AAD tenant to sign in with the &amp;lt;code&amp;gt;XboxLive.signin&amp;lt;/code&amp;gt; scope. Using an Azure AD tenant ID or the &amp;lt;code&amp;gt;common&amp;lt;/code&amp;gt; scope will just give errors. This also means you cannot sign in with users that are in the AAD tenant, only with consumer Microsoft accounts.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Authenticate with Xbox Live ==&lt;br /&gt;
Now that we are authenticated with Microsoft, we can authenticate with Xbox Live.&lt;br /&gt;
&lt;br /&gt;
To do that, we send&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;http&amp;quot;&amp;gt;&lt;br /&gt;
POST https://user.auth.xboxlive.com/user/authenticate&lt;br /&gt;
Content-Type: application/json&lt;br /&gt;
Accept: application/json&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot; line=&amp;#039;line&amp;#039;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;Properties&amp;quot;: {&lt;br /&gt;
        &amp;quot;AuthMethod&amp;quot;: &amp;quot;RPS&amp;quot;,&lt;br /&gt;
        &amp;quot;SiteName&amp;quot;: &amp;quot;user.auth.xboxlive.com&amp;quot;,&lt;br /&gt;
        &amp;quot;RpsTicket&amp;quot;: &amp;quot;d=&amp;lt;access token&amp;gt;&amp;quot; // your access token from the previous step here, make sure that it is prefixed with `d=`&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;RelyingParty&amp;quot;: &amp;quot;http://auth.xboxlive.com&amp;quot;,&lt;br /&gt;
    &amp;quot;TokenType&amp;quot;: &amp;quot;JWT&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again, it will complain if you don&amp;#039;t set &amp;lt;code&amp;gt;Content-Type: application/json&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;Accept: application/json&amp;lt;/code&amp;gt;.&lt;br /&gt;
It will also complain if your SSL implementation does not support SSL renegotiations.&lt;br /&gt;
&lt;br /&gt;
The response will look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot; line=&amp;#039;line&amp;#039;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;IssueInstant&amp;quot;: &amp;quot;2020-12-07T19:52:08.4463796Z&amp;quot;,&lt;br /&gt;
    &amp;quot;NotAfter&amp;quot;: &amp;quot;2020-12-21T19:52:08.4463796Z&amp;quot;,&lt;br /&gt;
    &amp;quot;Token&amp;quot;: &amp;quot;token&amp;quot;, // save this, this is your xbl token&lt;br /&gt;
    &amp;quot;DisplayClaims&amp;quot;: {&lt;br /&gt;
        &amp;quot;xui&amp;quot;: [&lt;br /&gt;
            {&lt;br /&gt;
                &amp;quot;uhs&amp;quot;: &amp;quot;userhash&amp;quot; // save this&lt;br /&gt;
            }&lt;br /&gt;
        ]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Obtain XSTS token for Minecraft ==&lt;br /&gt;
&lt;br /&gt;
Now that we are authenticated with XBL, we need to get a XSTS token, we can use to login to Minecraft.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;http&amp;quot;&amp;gt;&lt;br /&gt;
POST https://xsts.auth.xboxlive.com/xsts/authorize&lt;br /&gt;
Content-Type: application/json&lt;br /&gt;
Accept: application/json&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot; line=&amp;#039;line&amp;#039;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;Properties&amp;quot;: {&lt;br /&gt;
        &amp;quot;SandboxId&amp;quot;: &amp;quot;RETAIL&amp;quot;,&lt;br /&gt;
        &amp;quot;UserTokens&amp;quot;: [&lt;br /&gt;
            &amp;quot;xbl_token&amp;quot; // from above&lt;br /&gt;
        ]&lt;br /&gt;
    },&lt;br /&gt;
    &amp;quot;RelyingParty&amp;quot;: &amp;quot;rp://api.minecraftservices.com/&amp;quot;,&lt;br /&gt;
    &amp;quot;TokenType&amp;quot;: &amp;quot;JWT&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again, set content type and accept to json and ensure SSL renegotiation is supported by your client.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;Note:&amp;#039;&amp;#039; When trying to get the XSTS token for the &amp;#039;&amp;#039;&amp;#039;[[Minecraft:Minecraft Wiki:Projects/wiki.vg merge/Bedrock_Realms|bedrock realms]] API&amp;#039;&amp;#039;&amp;#039;, you need to change the following:  &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot;&amp;gt;&amp;quot;RelyingParty&amp;quot;: &amp;quot;https://pocket.realms.minecraft.net/&amp;quot;&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
also you can stop at this point, as the [[Minecraft:Minecraft Wiki:Projects/wiki.vg merge/Bedrock_Realms|bedrock realms]] API uses the XSTS token directly instead of a separate auth scheme.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Response will look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot; line=&amp;#039;line&amp;#039;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;IssueInstant&amp;quot;: &amp;quot;2020-12-07T19:52:09.2345095Z&amp;quot;,&lt;br /&gt;
    &amp;quot;NotAfter&amp;quot;: &amp;quot;2020-12-08T11:52:09.2345095Z&amp;quot;,&lt;br /&gt;
    &amp;quot;Token&amp;quot;: &amp;quot;token&amp;quot;, // save this, this is your xsts token&lt;br /&gt;
    &amp;quot;DisplayClaims&amp;quot;: {&lt;br /&gt;
        &amp;quot;xui&amp;quot;: [&lt;br /&gt;
            {&lt;br /&gt;
                &amp;quot;uhs&amp;quot;: &amp;quot;userhash&amp;quot; // same as last request&lt;br /&gt;
            }&lt;br /&gt;
        ]&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The endpoint can return a 401 error with the below response:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot; line=&amp;#039;line&amp;#039;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;Identity&amp;quot;: &amp;quot;0&amp;quot;,&lt;br /&gt;
    &amp;quot;XErr&amp;quot;: 2148916238,&lt;br /&gt;
    &amp;quot;Message&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
    &amp;quot;Redirect&amp;quot;: &amp;quot;https://start.ui.xboxlive.com/AddChildToFamily&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Redirect parameter usually will not resolve or go anywhere in a browser, likely they&amp;#039;re targeting Xbox consoles.&lt;br /&gt;
&lt;br /&gt;
Noted XErr codes and their meanings:&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;2148916227&amp;#039;&amp;#039;&amp;#039;: The account is banned from Xbox.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;2148916233&amp;#039;&amp;#039;&amp;#039;: The account doesn&amp;#039;t have an Xbox account. Once they sign up for one (or login through minecraft.net to create one) then they can proceed with the login. This shouldn&amp;#039;t happen with accounts that have purchased Minecraft with a Microsoft account, as they would&amp;#039;ve already gone through that Xbox signup process.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;2148916235&amp;#039;&amp;#039;&amp;#039;: The account is from a country where Xbox Live is not available/banned&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;2148916236&amp;#039;&amp;#039;&amp;#039;: The account needs adult verification on Xbox page. (South Korea)&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;2148916237&amp;#039;&amp;#039;&amp;#039;: The account needs adult verification on Xbox page. (South Korea)&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;2148916238&amp;#039;&amp;#039;&amp;#039;: The account is a child (under 18) and cannot proceed unless the account is added to a Family by an adult. This only seems to occur when using a custom Microsoft Azure application. When using the Minecraft launchers client id, this doesn&amp;#039;t trigger.&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;2148916262&amp;#039;&amp;#039;&amp;#039;: &amp;lt;i&amp;gt;TBD, happens rarely without any additional information.&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Authenticate with Minecraft ==&lt;br /&gt;
&lt;br /&gt;
Now we can finally start talking to Minecraft. The XSTS token from the last request allows us to authenticate with Minecraft using&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;http&amp;quot;&amp;gt;&lt;br /&gt;
POST https://api.minecraftservices.com/authentication/login_with_xbox&lt;br /&gt;
Content-Type: application/json&lt;br /&gt;
Accept: application/json&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot; line=&amp;#039;line&amp;#039;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;identityToken&amp;quot;: &amp;quot;XBL3.0 x=&amp;lt;userhash&amp;gt;;&amp;lt;xsts_token&amp;gt;&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Response:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot; line=&amp;#039;line&amp;#039;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;username&amp;quot;: &amp;quot;some uuid&amp;quot;, // this is not the uuid of the account&lt;br /&gt;
    &amp;quot;roles&amp;quot;: [],&lt;br /&gt;
    &amp;quot;access_token&amp;quot;: &amp;quot;minecraft access token&amp;quot;, // jwt, your good old minecraft access token&lt;br /&gt;
    &amp;quot;token_type&amp;quot;: &amp;quot;Bearer&amp;quot;,&lt;br /&gt;
    &amp;quot;expires_in&amp;quot;: 86400&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This access token allows us to launch the game, but, we haven&amp;#039;t actually checked if the account owns the game. Everything until here works with a normal Microsoft account!&lt;br /&gt;
&lt;br /&gt;
== Checking game ownership ==&lt;br /&gt;
&lt;br /&gt;
So let&amp;#039;s use our mc access token to check if a product licence is attached to the account.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;http&amp;quot;&amp;gt;&lt;br /&gt;
GET https://api.minecraftservices.com/entitlements/mcstore&lt;br /&gt;
Authorization: Bearer &amp;lt;Minecraft Access Token&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The access token goes into the auth header: &amp;lt;code&amp;gt;Authorization: Bearer &amp;lt;Minecraft Access Token&amp;gt;&amp;lt;/code&amp;gt;. (Keep in mind that &amp;lt;code&amp;gt;Bearer &amp;lt;/code&amp;gt; is actually the prefix you must include!)&lt;br /&gt;
&lt;br /&gt;
If the account owns the game, the response will look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot; line=&amp;quot;line&amp;quot;&amp;gt;{&lt;br /&gt;
    &amp;quot;items&amp;quot;: [ // re-ordered for better reading&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;product_minecraft&amp;quot;,&lt;br /&gt;
            &amp;quot;signature&amp;quot;: &amp;quot;jwt&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;game_minecraft&amp;quot;,&lt;br /&gt;
            &amp;quot;signature&amp;quot;: &amp;quot;jwt&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;product_minecraft_bedrock&amp;quot;,&lt;br /&gt;
            &amp;quot;signature&amp;quot;: &amp;quot;jwt&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;game_minecraft_bedrock&amp;quot;,&lt;br /&gt;
            &amp;quot;signature&amp;quot;: &amp;quot;jwt&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;product_dungeons&amp;quot;, // only present if user have Minecraft Dungeons&lt;br /&gt;
            &amp;quot;signature&amp;quot;: &amp;quot;jwt&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;game_dungeons&amp;quot;, // only present if user have Minecraft Dungeons&lt;br /&gt;
            &amp;quot;signature&amp;quot;: &amp;quot;jwt&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;product_legends&amp;quot;, // only present if user have Minecraft Legends&lt;br /&gt;
            &amp;quot;signature&amp;quot;: &amp;quot;jwt&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;game_legends&amp;quot;, // only present if user have Minecraft Legends&lt;br /&gt;
            &amp;quot;signature&amp;quot;: &amp;quot;jwt&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;product_game_pass_pc&amp;quot;, // only present if user get the game by Xbox Game Pass&lt;br /&gt;
            &amp;quot;signature&amp;quot;: &amp;quot;jwt&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;name&amp;quot;: &amp;quot;product_game_pass_ultimate&amp;quot;, // only present if user get the game by Xbox Game Pass (Ultimate?)&lt;br /&gt;
            &amp;quot;signature&amp;quot;: &amp;quot;jwt&amp;quot;&lt;br /&gt;
        },&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;signature&amp;quot;: &amp;quot;jwt&amp;quot;,&lt;br /&gt;
    &amp;quot;keyId&amp;quot;: &amp;quot;1&amp;quot;&lt;br /&gt;
}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The JWTs in items contain the values:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot; line=&amp;quot;line&amp;quot;&amp;gt;{&lt;br /&gt;
  &amp;quot;typ&amp;quot;: &amp;quot;JWT&amp;quot;,&lt;br /&gt;
  &amp;quot;alg&amp;quot;: &amp;quot;RS256&amp;quot;,&lt;br /&gt;
  &amp;quot;kid&amp;quot;: &amp;quot;1&amp;quot;,&lt;br /&gt;
  &amp;quot;x5t&amp;quot;: &amp;quot;IUtWwYtrS_IzIKJbi6s4kVh_E5s&amp;quot;&lt;br /&gt;
}.{&lt;br /&gt;
  &amp;quot;signerId&amp;quot;: &amp;quot;2535436228373764&amp;quot;,&lt;br /&gt;
  &amp;quot;name&amp;quot;: &amp;quot;product_minecraft&amp;quot; // varies for products / games&lt;br /&gt;
}.[Signature]&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
the last JWT looks like this decoded:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot; line=&amp;quot;line&amp;quot;&amp;gt;{&lt;br /&gt;
  &amp;quot;typ&amp;quot;: &amp;quot;JWT&amp;quot;,&lt;br /&gt;
  &amp;quot;alg&amp;quot;: &amp;quot;RS256&amp;quot;,&lt;br /&gt;
  &amp;quot;kid&amp;quot;: &amp;quot;1&amp;quot;,&lt;br /&gt;
  &amp;quot;x5t&amp;quot;: &amp;quot;IUtWwYtrS_IzIKJbi6s4kVh_E5s&amp;quot;&lt;br /&gt;
}.{&lt;br /&gt;
  &amp;quot;entitlements&amp;quot;: [ // re-ordered for better reading&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;product_minecraft&amp;quot; &lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;game_minecraft&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;product_minecraft_bedrock&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;game_minecraft_bedrock&amp;quot;&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;product_dungeons&amp;quot; // only present if user have Minecraft Dungeons&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;game_dungeons&amp;quot; // only present if user have Minecraft Dungeons&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;product_legends&amp;quot; // only present if user have Minecraft Legends&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;game_legends&amp;quot; // only present if user have Minecraft Legends&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;product_game_pass_pc&amp;quot; // only present if user get the game by Xbox Game Pass&lt;br /&gt;
    },&lt;br /&gt;
    {&lt;br /&gt;
      &amp;quot;name&amp;quot;: &amp;quot;product_game_pass_ultimate&amp;quot; // only present if user get the game by Xbox Game Pass (Ultimate?)&lt;br /&gt;
    }&lt;br /&gt;
  ],&lt;br /&gt;
  &amp;quot;signerId&amp;quot;: &amp;quot;2535436228373764&amp;quot;,&lt;br /&gt;
  &amp;quot;nbf&amp;quot;: 1765293178, // unix timestamp&lt;br /&gt;
  &amp;quot;exp&amp;quot;: 1765466158, // unix timestamp&lt;br /&gt;
  &amp;quot;iat&amp;quot;: 1765293358, // unix timestamp&lt;br /&gt;
  &amp;quot;platform&amp;quot;: &amp;quot;PC_LAUNCHER&amp;quot; // unknown if other values are present&lt;br /&gt;
}.[Signature]&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
If the account doesn&amp;#039;t own the game, the items array will be empty.&lt;br /&gt;
&lt;br /&gt;
Note that the signature should always be checked with the public key from Mojang to verify that it is a legitimate response from the official servers:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;pem&amp;quot;&amp;gt;&lt;br /&gt;
-----BEGIN PUBLIC KEY-----&lt;br /&gt;
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtz7jy4jRH3psj5AbVS6W&lt;br /&gt;
NHjniqlr/f5JDly2M8OKGK81nPEq765tJuSILOWrC3KQRvHJIhf84+ekMGH7iGlO&lt;br /&gt;
4DPGDVb6hBGoMMBhCq2jkBjuJ7fVi3oOxy5EsA/IQqa69e55ugM+GJKUndLyHeNn&lt;br /&gt;
X6RzRzDT4tX/i68WJikwL8rR8Jq49aVJlIEFT6F+1rDQdU2qcpfT04CBYLM5gMxE&lt;br /&gt;
fWRl6u1PNQixz8vSOv8pA6hB2DU8Y08VvbK7X2ls+BiS3wqqj3nyVWqoxrwVKiXR&lt;br /&gt;
kIqIyIAedYDFSaIq5vbmnVtIonWQPeug4/0spLQoWnTUpXRZe2/+uAKN1RY9mmaB&lt;br /&gt;
pRFV/Osz3PDOoICGb5AZ0asLFf/qEvGJ+di6Ltt8/aaoBuVw+7fnTw2BhkhSq1S/&lt;br /&gt;
va6LxHZGXE9wsLj4CN8mZXHfwVD9QG0VNQTUgEGZ4ngf7+0u30p7mPt5sYy3H+Fm&lt;br /&gt;
sWXqFZn55pecmrgNLqtETPWMNpWc2fJu/qqnxE9o2tBGy/MqJiw3iLYxf7U+4le4&lt;br /&gt;
jM49AUKrO16bD1rdFwyVuNaTefObKjEMTX9gyVUF6o7oDEItp5NHxFm3CqnQRmch&lt;br /&gt;
HsMs+NxEnN4E9a8PDB23b4yjKOQ9VHDxBxuaZJU60GBCIOF9tslb7OAkheSJx5Xy&lt;br /&gt;
EYblHbogFGPRFU++NrSQRX0CAwEAAQ==&lt;br /&gt;
-----END PUBLIC KEY-----&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
See the JWT standard[https://auth0.com/docs/tokens/json-web-tokens/validate-json-web-tokens] for more details.&lt;br /&gt;
&lt;br /&gt;
In case the public key ever changes, it can be extracted from the launcher library:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
strings ~/.minecraft/launcher/liblauncher.so &amp;gt; launcher-strings.txt&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The created file &amp;lt;code&amp;gt;launcher-strings.txt&amp;lt;/code&amp;gt; will include 2 strings which begin with &amp;lt;code&amp;gt;-----BEGIN PUBLIC KEY-----&amp;lt;/code&amp;gt; and end with &amp;lt;code&amp;gt;-----END PUBLIC KEY-----&amp;lt;/code&amp;gt;.&lt;br /&gt;
The first key seems to be the one used for the JWT tokens, use of the second key is unknown.&lt;br /&gt;
&lt;br /&gt;
== Getting the profile ==&lt;br /&gt;
&lt;br /&gt;
Now that we know that the account owns the game, we can get their profile in order to fetch the UUID:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;http&amp;quot;&amp;gt;&lt;br /&gt;
GET https://api.minecraftservices.com/minecraft/profile&lt;br /&gt;
Authorization: Bearer &amp;lt;Minecraft Access Token&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The response will look like this, if the account owns the game:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot; line=&amp;#039;line&amp;#039;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;id&amp;quot;: &amp;quot;986dec87b7ec47ff89ff033fdb95c4b5&amp;quot;, // the real uuid of the account, woo&lt;br /&gt;
    &amp;quot;name&amp;quot;: &amp;quot;HowDoesAuthWork&amp;quot;, // the mc user name of the account&lt;br /&gt;
    &amp;quot;skins&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: &amp;quot;6a6e65e5-76dd-4c3c-a625-162924514568&amp;quot;,&lt;br /&gt;
            &amp;quot;state&amp;quot;: &amp;quot;ACTIVE&amp;quot;,&lt;br /&gt;
            &amp;quot;url&amp;quot;: &amp;quot;http://textures.minecraft.net/texture/1a4af718455d4aab528e7a61f86fa25e6a369d1768dcb13f7df319a713eb810b&amp;quot;,&lt;br /&gt;
            &amp;quot;variant&amp;quot;: &amp;quot;CLASSIC&amp;quot;,&lt;br /&gt;
            &amp;quot;alias&amp;quot;: &amp;quot;STEVE&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ],&lt;br /&gt;
    &amp;quot;capes&amp;quot;: [&lt;br /&gt;
        {&lt;br /&gt;
            &amp;quot;id&amp;quot;: &amp;quot;5af20372-79e0-4e1f-80f8-6bd8e3135995&amp;quot;,&lt;br /&gt;
            &amp;quot;state&amp;quot;: &amp;quot;ACTIVE&amp;quot;,&lt;br /&gt;
            &amp;quot;url&amp;quot;: &amp;quot;http://textures.minecraft.net/texture/2340c0e03dd24a11b15a8b33c2a7e9e32abb2051b2481d0ba7defd635ca7a933&amp;quot;,&lt;br /&gt;
            &amp;quot;alias&amp;quot;: &amp;quot;Migrator&amp;quot;&lt;br /&gt;
        }&lt;br /&gt;
    ]&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Else it will look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;json&amp;quot; line=&amp;#039;line&amp;#039;&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
    &amp;quot;path&amp;quot;: &amp;quot;/minecraft/profile&amp;quot;,&lt;br /&gt;
    &amp;quot;error&amp;quot;: &amp;quot;NOT_FOUND&amp;quot;,&lt;br /&gt;
    &amp;quot;errorMessage&amp;quot;: &amp;quot;The server has not found anything matching the request URI&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that Xbox Game Pass users who haven&amp;#039;t logged into the new Minecraft Launcher at least once will not return a profile, and will need to login once after activating Xbox Game Pass to setup their Minecraft username.&lt;br /&gt;
&lt;br /&gt;
You should now have all necessary data (the mc access token, the username and the uuid) to launch the game. Well done!&lt;br /&gt;
&lt;br /&gt;
== Sample implementations ==&lt;br /&gt;
&lt;br /&gt;
* [https://gist.github.com/dewycube/223d4e9b3cddde932fbbb7cfcfb96759 minecraft_auth.py]: Authentication like the launcher does (i.e. code flow) + refresh token request. (broken)&lt;br /&gt;
* A fully working kotlin implementation can be found [https://gitlab.bixilon.de/bixilon/minosoft/-/blob/master/src/main/java/de/bixilon/minosoft/util/account/microsoft/MicrosoftOAuthUtils.kt] here using device tokens.&lt;br /&gt;
* A fully working cli wrapper in Java using device tokens [https://github.com/covers1624/DevLogin here]&lt;br /&gt;
* A rough sample implementation in Java (using javafx and its webview) [https://github.com/MiniDigger/MiniLauncher/blob/master/launcher/src/main/java/me/minidigger/minecraftlauncher/launcher/gui/MsaFragmentController.java here].&lt;br /&gt;
* A fully working Java library supporting 4 login flows can be found [https://github.com/RaphiMC/MinecraftAuth here].&lt;br /&gt;
* An implementation in Go [https://gist.github.com/rbrick/be8ed86864fc5d77aa6c979053cfc892 here].&lt;br /&gt;
* An implementation in JS can be found [https://github.com/PrismarineJS/node-minecraft-protocol/blob/master/src/client/microsoftAuth.js here] and one using JS/TS [https://gist.github.com/Plagiatus/ce5f18bc010395fc45d8553905e10f55 here]&lt;br /&gt;
* An implementation in Python can be found [https://codeberg.org/JakobDev/minecraft-launcher-lib/src/branch/master/minecraft_launcher_lib/microsoft_account.py here]&lt;br /&gt;
* An implementation in Rust can be found [https://gist.github.com/OverHash/a71b32846612ba09d8f79c9d775bfadf here].&lt;br /&gt;
* A Kotlin library (JVM + JS) can be found [https://github.com/TheNullicorn/ms-to-mca here].&lt;br /&gt;
* A C# library using webview and [https://github.com/AzureAD/microsoft-authentication-library-for-dotnet MSAL.NET] can be found [https://github.com/CmlLib/CmlLib.Core.Auth.Microsoft here].&lt;br /&gt;
* A Rust library can be found [https://crates.io/crates/minecraft-msa-auth here].&lt;br /&gt;
* A Rust library that includes useful stuff for launchers can be also found [https://crates.io/crates/minecraft-essentials here] (Deprecated).&lt;br /&gt;
* A PHP library can be found [https://github.com/Aberdeener/minecraft-oauth/ here].&lt;br /&gt;
* A Keycloak plugin for SSO can be found [https://github.com/groundsgg/keycloak-minecraft-idp here].&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
{{Navbox Java Edition technical|general}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Java Edition protocol]]&lt;br /&gt;
{{license wiki.vg}}&lt;br /&gt;
&lt;br /&gt;
[[Minecraft:fr:Authentification Microsoft]]&lt;br /&gt;
[[Minecraft:zh:Mojang API#Microsoft身份验证]]&lt;/div&gt;</summary>
		<author><name>SyncBot</name></author>
	</entry>
</feed>