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 parameter | Description |
---|---|
grant_type | Value must be refresh_token |
client_id | The Client ID of the app. |
client_secret | The Client Secret of the app. |
refresh_token | The 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.
Updated almost 2 years ago