This is my Code for getting token.
$code=$_REQUEST['code'];
$APPKEY="u8hj81KeQ9uQDyA1PBTTgw";
$req='https://platform.devtest.ringcentral.com/restapi/oauth/token';
$post = array (
'grant_type' => 'authorization_code',
'code' => $code ,
'redirect_uri' => 'http://localhost/token.php');
$ch = curl_init($req);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$apiKey = base64_encode($APPKEY);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Basic ' . $apiKey,
'Accept: application/json',
'Content-Type: application/x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
curl_close($ch);
$r=json_decode($response, true);
And the Response is
array (size=3) 'error' => string 'invalid_client' (length=14) 'error_description' => string 'Invalid client: ' (length=16) 'errors' => array (size=1) 0 => array (size=3) 'errorCode' => string 'OAU-153' (length=7)
'message' => string 'Invalid client: ' (length=16)
I am using the same Client ID for getting authorized Code.
Please Help me what is Wrong.
If you want to write your own, please reference https://github.com/ringcentral/ringcentral-php/blob/ac9984a8ae2e41239dfe84ae4f698f8a16b22417/src/Pla... and https://github.com/ringcentral/ringcentral-php/blob/ac9984a8ae2e41239dfe84ae4f698f8a16b22417/src/Pla...
<?php
$code=$_REQUEST['code'];
$APPKEY="u8hj81KeQ9uQDyA1PBTTgw";
$req='https://platform.devtest.ringcentral.com/restapi/oauth/token';
$post = array (
'grant_type' => 'authorization_code',
'code' => $code ,
'client_secret', => 'l_IDw9I3QgW1zirl_PlqoQmLJM4Df2TCOBeN5FcF8_lQ',
'redirect_uri' => 'http://localhost/token.php&client_id=u8hj81KeQ9uQDyA1PBTTgw');
$ch = curl_init($req);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$apiKey = base64_encode($APPKEY);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Basic ' . $apiKey,
'Accept: application/json',
'Content-Type: application/x-www-form-urlencoded'));
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
curl_close($ch);
$r=json_decode($response, true);
var_dump($r);
A new Community is coming to RingCentral!
Posts are currently read-only as we transition into our new platform.We thank you for your patience
during this downtime.
Try Workflow Builder
Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!Try RingCentral Workflow Builder