(oauth2)
Authorize
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
res = s.oauth2.authorize()
if res is not None:
# handle response
pass
Parameter |
Type |
Required |
Description |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.Oauth2AuthorizeResponseOauth2Authorize
Error Type |
Status Code |
Content Type |
models.SDKError |
4XX, 5XX |
*/* |
Request an access token using a valid grant.
import polar_sdk
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
res = s.oauth2.token(request={
"client_id": "<id>",
"client_secret": "<value>",
"code": "<value>",
"redirect_uri": "https://old-fort.name",
"grant_type": polar_sdk.GrantType.AUTHORIZATION_CODE,
})
if res is not None:
# handle response
pass
models.TokenResponse
Error Type |
Status Code |
Content Type |
models.SDKError |
4XX, 5XX |
*/* |
Revoke an access token or a refresh token.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
res = s.oauth2.revoke(request={
"token": "<value>",
"client_id": "<value>",
"client_secret": "<value>",
})
if res is not None:
# handle response
pass
models.RevokeTokenResponse
Error Type |
Status Code |
Content Type |
models.SDKError |
4XX, 5XX |
*/* |
Get information about an access token.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
res = s.oauth2.introspect(request={
"token": "<value>",
"client_id": "<value>",
"client_secret": "<value>",
})
if res is not None:
# handle response
pass
models.IntrospectTokenResponse
Error Type |
Status Code |
Content Type |
models.SDKError |
4XX, 5XX |
*/* |
Get information about the authenticated user.
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as s:
res = s.oauth2.userinfo()
if res is not None:
# handle response
pass
Parameter |
Type |
Required |
Description |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.Oauth2UserinfoResponseOauth2Userinfo
Error Type |
Status Code |
Content Type |
models.SDKError |
4XX, 5XX |
*/* |