this is my code
$data = array(
'grant_type' => 'Password',
'username' => 'username',
'password' => 'pwd',
'DeviceId' => ''
);
$url = "http://test/sync/oauth/token";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ( $status != 201 ) {
die("Error: call to URL $url failed with status $status, response $response, curl_error " . curl_error($curl) . ", curl_errno " . curl_errno($curl));
}
curl_close($curl);
print_r($response);`
I think is correct, but the server return me this error
Error: call to URL http://test/sync/oauth/token failed with status 400, response {"error":"unsupported_grant_type"}, curl_error , curl_errno 0
Where is the error?