Correct way to use a refresh_token in OAuth API

Linode Staff

How do I use the "refresh token" I've obtained to get a new "token"?

1 Reply

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

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct