declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Components;
$sdk = Polar\Polar::builder()->build();
$request = new Components\AuthorizationCodeTokenRequest(
clientId: '<id>',
clientSecret: '<value>',
code: '<value>',
redirectUri: 'https://memorable-season.name',
);
$response = $sdk->oauth2->token(
request: $request
);
if ($response->tokenResponse !== null) {
// handle response
}
{
"access_token": "<string>",
"token_type": "<string>",
"expires_in": 123,
"refresh_token": "<string>",
"scope": "<string>",
"id_token": "<string>"
}
Request an access token using a valid grant.
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Components;
$sdk = Polar\Polar::builder()->build();
$request = new Components\AuthorizationCodeTokenRequest(
clientId: '<id>',
clientSecret: '<value>',
code: '<value>',
redirectUri: 'https://memorable-season.name',
);
$response = $sdk->oauth2->token(
request: $request
);
if ($response->tokenResponse !== null) {
// handle response
}
{
"access_token": "<string>",
"token_type": "<string>",
"expires_in": 123,
"refresh_token": "<string>",
"scope": "<string>",
"id_token": "<string>"
}
Successful Response
The response is of type object
.
Was this page helpful?