How to solve the problem with the authorization API Mojang?

Wrote the authorization script to verify your account Mojang.
$post_data = array (
 "Username" => "dacruz1599@yahoo.com",
 "Password" => "Dominicc1599",
 "ClientToken" => "7c825a05-817a-4aad-939e-02c9dd3d923a"
);

$ch = curl_init("https://authserver.ely.by/auth/authenticate");

curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 4);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);

$output = curl_exec($ch);

But the API throws the error: {"error":"IllegalArgumentException","errorMessage":"credentials can not be null."}

Documentation: https://docs.ely.by/ru/minecraft-auth.html

We need to make autochecker, please help.
March 31st 20 at 15:38
2 answers
March 31st 20 at 15:40
Solution
If you read the original Doc mojang.com shows that the guys from ely.by at loggerheads with its fundamental errors:
— I forgot that the parameters necessary to pass to json (though, application/x-www-form-urlencoded works too);
— for some reason renamed all parameters with a capital letter.

Request
$curl = curl_init();

curl_setopt_array($curl, [
 CURLOPT_URL => "https://authserver.ely.by/auth/authenticate",
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_CUSTOMREQUEST => "POST",
 CURLOPT_POSTFIELDS =>"{\n\t\"username\":\"dacruz1599@yahoo.com\",\n\t\"password\":\"Dominicc1599\",\n\t\"clientToken\":\"7c825a05-817a-4aad-939e-02c9dd3d923a\"\n}",
 CURLOPT_HTTPHEADER => [
 "Content-Type: application/json"
],
]);

$response = curl_exec($curl);

gives a different answer:
{
 "error": "ForbiddenOperationException",
 "errorMessage": "Invalid credentials. Invalid email or password."
}
Thank you very much, you're the best <3 - hilma.Mull commented on March 31st 20 at 15:43
Ehhh I enter the correct username and password, still says incorrect... Strange...

<?

$rand = mt_rand(100000000,99999999999999999);

$json = array("username" => "danieldienes@gmx.de", "password"=>"emily1308", "clientToken"=> $rand);
$json = json_encode($json);


$curl = curl_init();

curl_setopt_array($curl, [
 CURLOPT_URL => "https://authserver.ely.by/auth/authenticate",
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_ENCODING => "",
 CURLOPT_MAXREDIRS => 10,
 CURLOPT_TIMEOUT => 0,
 CURLOPT_FOLLOWLOCATION => true,
 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 CURLOPT_CUSTOMREQUEST => "POST",
 CURLOPT_POSTFIELDS => $json
 CURLOPT_HTTPHEADER => [
 "Accept: application/json",
 "Content-Type: application/json"
],
]);

$response = curl_exec($curl);

echo $response;
?>
- hilma.Mull commented on March 31st 20 at 15:46
@prince60, the problem was solved without using ELY.BY - hilma.Mull commented on March 31st 20 at 15:49
March 31st 20 at 15:42
So you have an array in the array.
Uhh, I accidentally already from last forces has tried to do to take my array, without the array in the array also did not work. - hilma.Mull commented on March 31st 20 at 15:45
@prince60, to Know the return header curl?
Here I am in the comments pointed out a possible solution to the situation - Joanie_Deckow commented on March 31st 20 at 15:48
@prince60, please give a link to the documentation of this API. It is desirable from the description of the method auth. I have an error - credential not found. This means that username and password incorrect arguments, you may want to replace the username to login. - Daniela82 commented on March 31st 20 at 15:51
@Abigayle_Cummin, the Mirror API: https://docs.ely.by/ru/minecraft-auth.html
The official API: https://wiki.vg/Authentication - hilma.Mull commented on March 31st 20 at 15:54
@Abigayle_Cummin, https://docs.ely.by/ru/minecraft-auth.html#id3 - hilma.Mull commented on March 31st 20 at 15:57

Find more questions by tags API