Documentation of API
It can be found here: http://wiki.vg/index.php?title=Mojang_API&oldid=13450#User_Info
Status
This API is not working anymore. What happens when I make a quarry, is it returns "HTTP Error 401 Unauthorized".
Example Implementation of API
The following code was working fine (was returning info about the account) about half a year ago.
<?php
$token = "Put a Session ID / token here.";
$header = array( 'http'=>array( 'method'=>"GET", 'header'=>"Authorization: Bearer ".$token ));
$context = stream_context_create($header);
$result = file_get_contents('https://api.mojang.com/user', false, $context);
echo $result;
?>
Comments 4
I changed the Security Level because there appears to be no private information in this report and the described problem is not an exploit or something similar.
I noticed this a few months ago, seeing as this documentation is not directly provided by Mojang its very possible it has changed. I just cache the information I need from the authenticate request which returns all the same info. I would question why you need most this information though as a lot of it is irrelevant to Minecraft itself.
Please contact support with your issue: https://help.minecraft.net/hc/en-us/requests/new
Maybe the API requires either that the security questions are answered, or that a captcha is completed, since minecraft.net uses this API as well and there it works.
After logging in on minecraft.net it works with a script like yours as well.