Skip to main content
POST
/
v1
/
oauth2
/
token
Python (SDK)
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)
{
  "access_token": "<string>",
  "token_type": "<string>",
  "expires_in": 123,
  "refresh_token": "<string>",
  "scope": "<string>",
  "id_token": "<string>"
}

Body

application/x-www-form-urlencoded
grant_type
string
required
Allowed value: "authorization_code"
client_id
string
required
client_secret
string
required
code
string
required
redirect_uri
string<uri>
required
Required string length: 1 - 2083

Response

200 - application/json

Successful Response

access_token
string
required
token_type
string
required
Allowed value: "Bearer"
expires_in
integer
required
refresh_token
string | null
required
scope
string
required
id_token
string
required