Refresh an Access Token
Refresh an Access Token
To authenticate to the Box API the Postman collection will use an Access Token to identify you, the User to the API. Access tokens expire after 1 hour and therefore need to be refreshed every hour.
Using a Refresh Token
If you set up your own Box App in step
2 of the Postman Quick
Start guide then your Box environment in Postman should include a valid
client_id
and client_secret
. These client credentials and the
refresh_token
can be used to create a new value for the access_token
.
To refresh the access token, select the Refresh access token API call within the Authorization folder of the Postman collection.
Next, click the Send button to request a new access_token
.
At the end of this API call, your environment should have a new access_token
and refresh_token
value, and you should be able to make any of the other API
calls.
Automatically refreshing an access token
The Postman collection can automatically detect an expired access_token
value
and request a new one by using the refresh_token
. By default this feature is
enabled but it can be turned off by setting the enable_auto_refresh_access_token
Postman environment variable to false
.
To set this value, click the edit button in the top right of your Box Postman environment variables.
Find the row in the table for the enable_auto_refresh_access_token
variable
and set the Current Value to true
. Next, click Update to save your
changes.
From now on, any time you make any API call the Postman collection will
check if your access_token
has expired and try to refresh it automatically
before making your desired API call.
Re-authenticating your Postman collection
In some cases you might need to re-authenticate your Postman collection by going
through the Quick Start guide again. A common
reason for this is because you haven't used the Postman collection in over 60
days and your refresh_token
has expired.
To re-authenticate, first remove your old Box Postman environment. To do so, click the little gear icon in the top right and select your environment from the list.
Select Delete to delete the environment. Then, restart the Postman Quick Start guide again from the start.