Correct way to use a refresh_token in OAuth API
Linode
Linode Staff
How do I use the "refresh token" I've obtained to get a new "token"?
1 Reply
mchialastri
Linode Staff
Your CURLOPT_POSTFIELDS
should look similar to the below:
curl_setopt($ch, CURLOPT_POSTFIELDS, [
'grant_type' => 'refresh_token',
'client_id' => $this->config['client_id'],
'client_secret' => $this->config['client_secret'],
'refresh_token' => $this->user->refresh_token
]);
You should then get back a response similar to this:
{ "scopes": "some-scopes", "access_token": "new-token", "refresh_token": "new-refresh-token", "expiries_in": 3600 }
I also recommend reviewing these other resources on OAuth: How To Create an OAuth App with the Linode Python API Library
Include required grant_type
parameter in docs for refreshing oauth tokens