Refreshing access tokens

Access tokens expire in 7200 seconds (i.e., 2 hours) after they are generated. In order to refresh an access token, you must make a POST request to the https://developers.teachable.com/v1/current_user/oauth2/token endpoint. In the body of the request, include the following parameters:

Body parameterDescription
grant_typeValue must be refresh_token
client_idThe Client ID of the app.
client_secretThe Client Secret of the app.
refresh_tokenThe refresh_token received after exchanging an authorization code for an access token.

๐Ÿ“˜

Tip

For more information on how to retrieve the client ID, client secret, and refresh token, refer to the OAuth Quickstart Guide.

For example, below is a sample request to refresh an access token:

curl -X POST \
  --url "https://developers.teachable.com/v1/current_user/oauth2/token" \
  --data "grant_type=refresh_token" \
  --data "client_id=1234" \
  --data "client_secret=5678" \
  --data "refresh_token=xyz456" \

๐Ÿ“˜

Note

The content-type of request body could be either JSON or form-data.

On a successful request, a JSON body is returned with the following attributes (including a new access token):

{
    "refresh_token": "xyz456",
    "token_type": "bearer",
    "access_token": "789lmno",
    "expires_in": 7200
}

You can then use the new access token to continue to make requests to the Teachable API.