Skip to content

Latest commit

 

History

History
236 lines (148 loc) · 9.6 KB

README.md

File metadata and controls

236 lines (148 loc) · 9.6 KB

Oauth2

(oauth2)

Overview

Available Operations

authorize

Authorize

Example Usage

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
}

Response

?Operations\Oauth2AuthorizeResponse

Errors

Error Type Status Code Content Type
Errors\APIException 4XX, 5XX */*

introspect

Get information about an access token.

Example Usage

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
}

Parameters

Parameter Type Required Description
$request Operations\Oauth2IntrospectTokenIntrospectTokenRequest ✔️ The request object to use for the request.

Response

?Operations\Oauth2IntrospectTokenResponse

Errors

Error Type Status Code Content Type
Errors\APIException 4XX, 5XX */*

token

Request an access token using a valid grant.

Example Usage

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
}

Parameters

Parameter Type Required Description
$request Components\Onev11oauth21tokenPostXComponentsAuthorizationCodeTokenRequest|Components\Onev11oauth21tokenPostXComponentsRefreshTokenRequest ✔️ The request object to use for the request.

Response

?Operations\Oauth2RequestTokenResponse

Errors

Error Type Status Code Content Type
Errors\APIException 4XX, 5XX */*

revoke

Revoke an access token or a refresh token.

Example Usage

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
}

Parameters

Parameter Type Required Description
$request Operations\Oauth2RevokeTokenRevokeTokenRequest ✔️ The request object to use for the request.

Response

?Operations\Oauth2RevokeTokenResponse

Errors

Error Type Status Code Content Type
Errors\APIException 4XX, 5XX */*

userinfo

Get information about the authenticated user.

Example Usage

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
}

Response

?Operations\Oauth2UserinfoResponse

Errors

Error Type Status Code Content Type
Errors\APIException 4XX, 5XX */*