When I do the post request to the API:
parameters = {
'xtoken': 'XBL3.0 x=2943422849521235560;example',
'platform': 'PC_LAUNCHER'
}
parameters = json.dumps(parameters)
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36",
"Content-Type": "application/json",
"Accept": "application/json"
}
a = requests.post("https://api.minecraftservices.com/launcher/login", parameters, headers=headers)
print(a.text)
The expected result would be:
{
"username" : "830491e6-50e9-e9ed-6e8a-7041f4fef585", // Xbox account username (?)
"roles" : [ ], // i suppose this will have something in it if the account has a copy of Minecraft
"access_token" : "eyJhbGciOiJIUzI1NiJ9.eyJ4dWlkIjogIjI1NTY3MzEwMzg0NzMzNTUiLCJzdWIiOiAiOGQ2YzVhMTItMzk2ZS00OWE1LTk1Y2QtZTczYmExODllNTIzIiwibmJmIjogMTYwNjg0NTE0Niwicm9sZXMiOiBbXSwiaXNzIjogImF1dGhlbnRpY2F0aW9uIiwiZXhwIjogMTYwNjkzMTU0NiwiaWF0IjogMTYwNjg0NTE0NiwieXVpZCI6ICIyMWQyZDJmOWUyYzU0MmQ0OGZlMmJiMjY4MzhmYjhkMiJ9.-7H1jT3i54gmbqQcUBdHArOn-Jr8eZVAyPDiOr5q_XY", // access token
"token_type" : "Bearer", // don't think there are other types
"expires_in" : 86400 // number of seconds until token expires. MSA tokens last 24 hours. yes, really, 24 hours!
}
However when I run the code I get this error instead:
{
"path" : "/authentication/login_with_xbox",
"error" : "UNAUTHORIZED"
}
Any help would be thankfull.