Refreshing access token
An access_token
will expire 5 min after we generated it. After this, you'll be denied access if you keep using that token.
To get a new one, you will have to use the refresh_token
you acquired in the connect flow. These last for 90 days.
To refresh your access_token
, you can call:
{ curl -D- -X POST https://umbracodemo1.ucommerce.net/api/v1/oauth/token \ -u <CLIENT_ID>:<CLIENT_SECRET> \ -H 'Content-Type: application/json' \ -d '{ "grant_type" : "refresh_token", "refresh_token" : "{refresh_token}" }' }
If the refresh token is still valid, you get a response like this:
{ "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI797234J9.eyJ1c2VySWQiOiJmYTE4OTI3MS1mOTY1LTRmNWMtOTlmOS1lNDViNzNiYzI4MzkiLCJjbGllbnRJZCI6InZpaWEtZnBwIiwicm9sZSI6IkNsaWVudFVzZXIiLCJzZXNzaW9uSWQiOiJhZGIy097298234gtYWM4Yy1kYWM5Zjk0NTk3ZWQiLCJuYmYiOjE1Njc1MDAwOTQsImV4cCI6MTU2NzUwMzY5NCwiaWF0IjoxNTY3NTAwMDk0fQ.39njmCN97823498UbPXUiXl_SmWgnxM2x9phxhAxYI", "expires_in": 300, "redirect_uri": null, "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI797234J9.eyJ12Vy98762872344OTI3MS1mOTY1LTRmNWMtOTlmOS1lNDViNzNiYzI4MzkiLCJjbGllbnRJZCI6InZpaWEtZnBwIiwiY29uc2VudElkIjoiYTYyODExYWYtNzUxMS00ZWQ0LThiYTEtMjAwNzc2NGQ1MTIwIiwic2Vzc2lvbklkIjoiYWRiMjEyNmEtOTczZi00OWI4LWFjOGMtZGFjOWY5NDU5N2VkIiwicm9sZSI6IlJlZnJlc2hUb2tlbiI98o727934UwMDA5NCwiZXhwIjoxNTY4NzA5Njk0LCJpYXQiOjE1Njc1MDAwOTR9.6eBV4OH96782734HEQoMbB_9yedl_2JfzsiSNcwa0", "token_type": "bearer" }
Now you can safely throw away the old access and refresh token, and start using the two new.
Lost or expired refresh token
If you lose your refresh token or if it expires. The only way to get new ones, is to go through the connect flow again.