{ "error" : "unauthorized_client", "error_description" : "Unauthorized for this grant type", "errors" : [ { "errorCode" : "OAU-251", "message" : "Unauthorized for this grant type" } ] }
Here is my code below:-
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://platform.devtest.ringcentral.com/restapi/oauth/token"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "username=+12048184079&password=Reset321$$&extension=101&grant_type=password"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_USERPWD, "1RjNgM-LTxxxxxFuE-ggrHA" . ":" . "524fjcxxxxxxxxxxCPclIZHxxxxxx_FdfegzA"); $headers = array(); $headers[] = "Accept: application/json"; $headers[] = "Content-Type: application/x-www-form-urlencoded"; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); echo '<pre>'; print_r($result); die; if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close ($ch);