Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


In case of expired token you need to refresh it (HTTP 401)

in In case of HTTP 401 error you need to refresh the authorization token, getting a new one by means of the refresh token. Please note that also the refresh token "refresh token" is renewed with the request and the new value is returned in the response body.  

Code Block
titleRefresh the access token
// #1 When resource access fails because token is expired
curl -H "Authorization:Bearer MYACCESSTOKEN" /
		-H "Content-Type:application/x-www-form-urlencoded" MYRESOURCEENDPOINT 
Response:{"ErrorCode":"401","ErrorDescription":"Authorization error: Access token is expired","ErrorName":"Unauthorized","ErrorStack":null}
// #2 First you need to get a new token
curl -X POST -d "client_id=MYCLIENTID&client_secret=MYCLIENTSECRET&refresh_token=MYREFRESHTOKEN&grant_type=refresh_token" /
Response:{	"access_token":"MYNEWACCESSTOKEN","expires_in":3600,"refresh_token":"MYNEWREFRESHTOKEN"}

// #3 Then you can successfully access to the resource by using the new token
curl -H "Authorization:Bearer MYNEWACCESSTOKEN" /
		-H "Content-Type:application/x-www-form-urlencoded" MYRESOURCEENDPOINT