POST
/
v1
/
oauth2
/
token
PHP (SDK)
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>"
}

Body

application/x-www-form-urlencoded

Response

200 - application/json

Successful Response

The response is of type object.