Refresh token
Overview
An access token is always valid for a limited amount of time – indicated in seconds in the expires_in
property of the JSON response.
Example of a JSON response with an access token and a refresh token:
{
"access_token": "<ACCESS_TOKEN>",
"expires_in": 36000, // access token validity in seconds
"refresh_token": "<REFRESH_TOKEN>"
}
The refresh token allows you to request a new access token once the last one expired without having to use user credentials again.
Implementation
To do so, you need to make a POST
request to the token endpoint and include the following parameters:
grant_type
: set torefresh_token
to specify the grant type flowclient_id
: your API keyclient_secret
: your API secretrefresh_token
: the refresh token retrieved with your access token
Request example:
POST /oauth/token HTTP/1.1
Host: api.dailymotion.com
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token
&client_id=<API_KEY>
&client_secret=<API_SECRET>
&refresh_token=<REFRESH_TOKEN>
POST /oauth/token HTTP/1.1
Host: graphql.api.dailymotion.com
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token
&client_id=<API_KEY>
&client_secret=<API_SECRET>
&refresh_token=<REFRESH_TOKEN>
In return, you will get the following JSON response:
{
"access_token": "<ACCESS_TOKEN>",
"expires_in": 36000,
"refresh_token": "<REFRESH_TOKEN>"
}