Difference between revisions of "Talk:Mojang API"

From wiki.vg
Jump to navigation Jump to search
 
(6 intermediate revisions by 3 users not shown)
Line 9: Line 9:
  
 
I was wondering how to get the access token programmatically, as I want to continue my plugin CustomSkins. Creating a howto which involves using chrome network tools (for example) is the last option I'd like to go. [[User:Janmm14|Janmm14]] ([[User talk:Janmm14|talk]])
 
I was wondering how to get the access token programmatically, as I want to continue my plugin CustomSkins. Creating a howto which involves using chrome network tools (for example) is the last option I'd like to go. [[User:Janmm14|Janmm14]] ([[User talk:Janmm14|talk]])
 +
:Everything you need is right [[Authentication#Authenticate|here]]. Here is an example with cURL:
 +
:<code>curl https://authserver.mojang.com/authenticate --data-binary @login.txt -H "Content-Type: application/json"</code>
 +
:Here is login.txt:
 +
<div style="margin-left: 2em;"><source lang="json">{
 +
  "agent":{"name":"Minecraft","version":1},
 +
  "username":"username",
 +
  "password":"password",
 +
  "clientToken":"clientToken"
 +
}</source></div>
 +
:--[[User:Max Shen|Max Shen]] ([[User talk:Max Shen|talk]]) 20:20, 16 July 2016 (UTC)
 +
 +
== What does this exception mean? ==
 +
 +
I remember I was able to collect some information, like the registered ip, on a token by sending a get request to "https://api.mojang.com/user" with the "Authorization: Bearer <token>" header. Now when I send this request I am met with this response:
 +
 +
<syntaxhighlight lang="json">{"error":"UnauthorizedOperationException","errorMessage":"User not authenticated"}</syntaxhighlight>
 +
 +
Has Mojang changed their API? This used to work a few months ago.
 +
 +
== Name Change API Call ==
 +
 +
How do you change your username via API?
 +
 +
== Add api.minecraftservices.com/publickeys ==
 +
 +
This API endpoint is responsible for providing public keys used to verify that profile properties and player chat signing keys came from Mojang

Latest revision as of 11:49, 17 June 2024

Skin Change API call

I've added the API call for skin changes but it'll need some editing to fit in with the other calls on the page. --Tron (talk) 17:39, 21 March 2016 (UTC)

How exactly should the payload look like? Whatever I send (even garbage data) I get back a 403 HTTP response with
{"error":"Forbidden","errorMessage":"Current IP not secured"}
--Grego87 (talk) 00:00, 3 May 2016 (UTC)
I've tried editing the article to address these two issues. To do so I looked at Mojang's implementation (05/18/2016 archive, depack here) and various error messages their servers returned my cURL attempts. I've been trying to find an API for 'deleting/resetting' skins, but I cannot understand this mechanism (it would help if I knew javascript). For a good starting point search up "onResetSkinClick". --Max Shen (talk) 07:43, 20 May 2016 (UTC)

How to get the bearer access token?

I was wondering how to get the access token programmatically, as I want to continue my plugin CustomSkins. Creating a howto which involves using chrome network tools (for example) is the last option I'd like to go. Janmm14 (talk)

Everything you need is right here. Here is an example with cURL:
curl https://authserver.mojang.com/authenticate --data-binary @login.txt -H "Content-Type: application/json"
Here is login.txt:
{
  "agent":{"name":"Minecraft","version":1},
  "username":"username",
  "password":"password",
  "clientToken":"clientToken"
}
--Max Shen (talk) 20:20, 16 July 2016 (UTC)

What does this exception mean?

I remember I was able to collect some information, like the registered ip, on a token by sending a get request to "https://api.mojang.com/user" with the "Authorization: Bearer <token>" header. Now when I send this request I am met with this response:

{"error":"UnauthorizedOperationException","errorMessage":"User not authenticated"}

Has Mojang changed their API? This used to work a few months ago.

Name Change API Call

How do you change your username via API?

Add api.minecraftservices.com/publickeys

This API endpoint is responsible for providing public keys used to verify that profile properties and player chat signing keys came from Mojang