Amriteya
Amriteya

Reputation: 1172

Accessing Box Api using Refresh token

How can we access the Box API using the refresh token that is generated? I have followed all the steps to generate the access token and refresh token but I cannot find it anywhere how can I access the API using refresh token.

This is what I have right now:

curl -X GET -H "Authorization: Bearer <Access-Token>" "https://api.box.com/2.0/folders/0"

I am not able to do this :

curl -X GET -H "Authorization: <Refresh-Token>" "https://api.box.com/2.0/folders/0"

or

curl -X GET -H "Authorization: Bearer <Refresh-Token>" "https://api.box.com/2.0/folders/0"

Any idea how we can use the Refresh token in an API call?

Upvotes: 0

Views: 1078

Answers (1)

kendomen
kendomen

Reputation: 778

The access_token is used to make Box Content API calls.

The refresh_token is used to obtain a new access_token & refresh_token pair since access_tokens expire in around 60 minutes.

curl https://api.box.com/oauth2/token 
-d 'grant_type=refresh_token' \
-d 'refresh_token=<MY_REFRESH_TOKEN>' \
-d 'client_id=<MY_CLIENT_ID>' \
-d 'client_secret=<MY_CLIENT_SECRET>' \
-X POST

Upvotes: 3

Related Questions