Skip to content

Latest commit

 

History

History
72 lines (57 loc) · 2.45 KB

_refresh-token.md

File metadata and controls

72 lines (57 loc) · 2.45 KB

Refresh Token

POST https://${account.namespace}/oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=refresh_token&client_id=${account.clientId}&client_secret=YOUR_CLIENT_SECRET&refresh_token=YOUR_REFRESH_TOKEN
curl --request POST \
  --url 'https://${account.namespace}/oauth/token' \
  --header 'content-type: application/x-www-form-urlencoded' \
  --data 'grant_type=refresh_token&client_id=${account.clientId}&client_secret=YOUR_CLIENT_SECRET&refresh_token=YOUR_REFRESH_TOKEN'
var request = require("request");

var options = { method: 'POST',
  url: 'https://${account.namespace}/oauth/token',
  headers: { 'content-type': 'application/x-www-form-urlencoded' },
  form:
   { grant_type: 'refresh_token',
     client_id: '${account.clientId}',
     client_secret: 'YOUR_CLIENT_SECRET',
     refresh_token: 'YOUR_REFRESH_TOKEN'}
   };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

RESPONSE SAMPLE:

HTTP/1.1 200 OK
Content-Type: application/json
{
  "access_token": "eyJ...MoQ",
  "expires_in": 86400,
  "scope": "openid offline_access",
  "id_token": "eyJ...0NE",
  "token_type": "Bearer"
}

<%= include('../../../_includes/_http-method', { "http_badge": "badge-success", "http_method": "POST", "path": "/oauth/token", "link": "#refresh-token" }) %>

Use this endpoint to refresh an Access Token using the Refresh Token you got during authorization.

Request Parameters

Parameter Description
grant_type
Required
Denotes the flow you are using. To refresh a token, use refresh_token.
client_id
Required
Your application's Client ID.
client_secret Your application's Client Secret. Required when the Token Endpoint Authentication Method field at your Application Settings is Post or Basic.
refresh_token
Required
The refresh token to use.
scope A space-delimited list of requested scope permissions. If not sent, the original scopes will be used; otherwise you can request a reduced set of scopes. Note that this must be URL encoded.

Learn More