(oauth2)
Authorize
from polar_sdk import Polar
with Polar(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as polar:
res = polar.oauth2.authorize()
# Handle response
print(res)
| 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.
from polar_sdk import Polar
with Polar() as polar:
res = polar.oauth2.token(request={
"grant_type": "authorization_code",
"client_id": "<id>",
"client_secret": "<value>",
"code": "<value>",
"redirect_uri": "https://memorable-season.name",
})
# Handle response
print(res)
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() as polar:
res = polar.oauth2.revoke(request={
"token": "<value>",
"client_id": "<id>",
"client_secret": "<value>",
})
# Handle response
print(res)
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() as polar:
res = polar.oauth2.introspect(request={
"token": "<value>",
"client_id": "<id>",
"client_secret": "<value>",
})
# Handle response
print(res)
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 polar:
res = polar.oauth2.userinfo()
# Handle response
print(res)
| 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 |
*/* |