I am trying to get accessToken as written here: 1.8 API Introduction
I must say right away that there are 2 errors in the example code:
-
we do not have “,” at the end of the line
‘responseType’ => “JSON_OR_STRING” -
in line
$ token = $ this → provider → getAccessToken (“authorizaton_code”, [
error, no need to use $ this-> here:
$ token = $ provider → getAccessToken (“authorizaton_code”, [
In any case, it is not possible to get an accessToken using this.
My attempt to get the token:
$url = “http://dev…/”;
$authPath = “api/authorize/access_token”;
$clientId = “30a5b2a…”;
$clientSecret = “64be54ed0…”;
$provider = new \Xibo\OAuth2\Client\Provider\Xibo([
‘sandbox’ => true,
‘clientId’ => $clientId,
‘clientSecret’ => $clientSecret,
‘responseType’ => ‘json’,
‘redirectUri’ => $url
]);
//$token = $provider->getAccessToken(‘refresh_token’, [
// ‘grant_type’ => ‘refresh_token’,
// ‘refresh_token’ => “REFRESH_TOKEN”
//]);
// OR (to get the token)
$token = $provider->getAccessToken(“authorizaton_code”, [
//‘code’ => $_GET[‘code’]
]);
print_r($token);
Please, tell me, what am I doing wrong?
( ! ) Fatal error: Uncaught League\OAuth2\Client\Grant\Exception\InvalidGrantException: Grant “League\OAuth2\Client\Grant\AuthorizatonCode” must extend AbstractGrant in C:\wamp\www\xibo\vendor\league\oauth2-client\src\Grant\GrantFactory.php on line 98
( ! ) League\OAuth2\Client\Grant\Exception\InvalidGrantException: Grant “League\OAuth2\Client\Grant\AuthorizatonCode” must extend AbstractGrant in \vendor\league\oauth2-client\src\Grant\GrantFactory.php on line 98