Hi,
We are performing Auth2.0 PKCE for authorization purposes. As per the documentation following all the processes.
1. Generate Verify and challenge for PKCE
2. User login and consent
The above two processes are done, successfully.
When we are performing
3. Exchange auth code for an access token
The error we are getting is :
{
"error": "invalid_client",
"errors": [
{
"errorCode": "OAU-123",
"message": "Client authentication is required"
}
],
"error_description": "Client authentication is required"
}
//Pasting my return URI Code Below, Please let me know what we need to do in order to resolve the issue
It's a PHP code,
<?php
$code = $_REQUEST['code'];
$state = $_REQUEST['state'];
if ($code)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://platform.devtest.ringcentral.com/restapi/oauth/token");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "code=$code&grant_type=authorization_code&client_id=<client-id>&code_verifier=LQCmsfhneP9_R2jQ85En9RO--ohyrIKmej3rpocjjaE&redirect_uri=https://my.callback/listener_ringcentral.php");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/x-www-form-urlencoded'
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
try
{
$server_output = curl_exec($ch);
}
catch(Exception $e)
{
echo '<pre>';
print_r($e->getMessage());
}
curl_close($ch);
// Further processing ...
echo '<pre>';
print_r($server_output);
if ($server_output == "OK")
{
echo '<pre>';
print_r($server_output);
}
else
{
echo 'Failed CURLLLLL';
}
}
?>