(oauth2)
- authorize - Authorize
- introspect - Introspect Token
- token - Request Token
- revoke - Revoke Token
- userinfo - Get User Info
Authorize
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Polar\Polar::builder()->setSecurity($security)->build();
$response = $sdk->oauth2->authorize(
);
if ($response->responseOauth2Authorize !== null) {
// handle response
}
?Operations\Oauth2AuthorizeResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\APIException | 4XX, 5XX | */* |
Get information about an access token.
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Operations;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Polar\Polar::builder()->setSecurity($security)->build();
$request = new Operations\Oauth2IntrospectTokenIntrospectTokenRequest(
token: '<value>',
clientId: '<id>',
clientSecret: '<value>',
);
$response = $sdk->oauth2->introspect(
request: $request
);
if ($response->introspectTokenResponse !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\Oauth2IntrospectTokenIntrospectTokenRequest | ✔️ | The request object to use for the request. |
?Operations\Oauth2IntrospectTokenResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\APIException | 4XX, 5XX | */* |
Request an access token using a valid grant.
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Components;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Polar\Polar::builder()->setSecurity($security)->build();
$request = new Components\Onev11oauth21tokenPostXComponentsAuthorizationCodeTokenRequest(
clientId: '<id>',
clientSecret: '<value>',
code: '<value>',
redirectUri: 'https://old-fort.name',
);
$response = $sdk->oauth2->token(
request: $request
);
if ($response->tokenResponse !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Components\Onev11oauth21tokenPostXComponentsAuthorizationCodeTokenRequest|Components\Onev11oauth21tokenPostXComponentsRefreshTokenRequest | ✔️ | The request object to use for the request. |
?Operations\Oauth2RequestTokenResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\APIException | 4XX, 5XX | */* |
Revoke an access token or a refresh token.
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Operations;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Polar\Polar::builder()->setSecurity($security)->build();
$request = new Operations\Oauth2RevokeTokenRevokeTokenRequest(
token: '<value>',
clientId: '<id>',
clientSecret: '<value>',
);
$response = $sdk->oauth2->revoke(
request: $request
);
if ($response->revokeTokenResponse !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\Oauth2RevokeTokenRevokeTokenRequest | ✔️ | The request object to use for the request. |
?Operations\Oauth2RevokeTokenResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\APIException | 4XX, 5XX | */* |
Get information about the authenticated user.
declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
$security = '<YOUR_BEARER_TOKEN_HERE>';
$sdk = Polar\Polar::builder()->setSecurity($security)->build();
$response = $sdk->oauth2->userinfo(
);
if ($response->responseOauth2Userinfo !== null) {
// handle response
}
?Operations\Oauth2UserinfoResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\APIException | 4XX, 5XX | */* |