API 인증 관련 문의. oauth2-xibo-cms

CMS version 3.3.3

An error occurs when connecting through the API.

PHP Fatal error: Uncaught Xibo\OAuth2\Client\Exception\XiboApiException: {“error”:“invalid_client”,“error_description”:“Client authentication failed”,“message”:“Client authentication failed”} in C:\inetpub\wwwroot\oauth2-xibo-cms-develop\src\Provider\Xibo.php:92
Stack trace:
#0 C:\inetpub\wwwroot\oauth2-xibo-cms-develop\vendor\league\oauth2-client\src\Provider\AbstractProvider.php(613): Xibo\OAuth2\Client\Provider\Xibo->checkResponse(Object(GuzzleHttp\Psr7\Response), Array)
#1 C:\inetpub\wwwroot\oauth2-xibo-cms-develop\vendor\league\oauth2-client\src\Provider\AbstractProvider.php(528): League\OAuth2\Client\Provider\AbstractProvider->getParsedResponse(Object(GuzzleHttp\Psr7\Request))
#2 C:\inetpub\wwwroot\oauth2-xibo-cms-develop\example\simple.php(37): League\OAuth2\Client\Provider\AbstractProvider->getAccessToken(Object(League\OAuth2\Client\Grant\ClientCredentials))
#3 {main}
thrown in C:\inetpub\wwwroot\oauth2-xibo-cms-develop\src\Provider\Xibo.php on line 92

=========================================================================

I tried to connect cms using the oauth2-xibo-cms-develop library.

$clientId = “d7a…”;
$clientSecret = “c1f6cd…”;

$provider = new \Xibo\OAuth2\Client\Provider\Xibo([
‘clientId’ => $clientId, // The client ID assigned to you by the provider
‘clientSecret’ => $clientSecret, // The client password assigned to you by the provider
‘redirectUri’ => ‘’,
‘baseUrl’ => ‘http://192.168.0.3
], [‘logger’ => $log]);

if (!isset($argv[1])) {
$token = $provider->getAccessToken(‘client_credentials’)->getToken();
echo 'Token for next time: ’ . $token;
}
else
$token = $argv[1];


I don’t know what is wrong, please help me
Thanks in advance for any help.

Hi,

Please can you turn on logging in your CMS and repeat the API request to see if there are any significant errors logged when you do that?

Thanks!

Thanks for your reply! this is log

Please can you try supplying your redirectUri as null instead of empty string?

1 Like

The error is gone.
I’ve been struggling to find an solution for days, thank you so much.

1 Like

You’re welcome! I’m pleased its working.