1
votes

I am using box API.
through Authentication i got Access Token(AT) and Refresh Token(RT).
After 1 hour AT is expired. Now i am requesting to server with current RT

Request:-
Post
https://api.box.com/oauth2/token
Params :-
1) grant_type
2) client_id
3) client_secret
4) refersh_token

Actual result is like this
{
access_token:new AT
refersh_token:new RT
.....
.....
}

but my result is
{
"error": "invalid_grant",
"error_description": "Refresh token has expired"
}

Please help me.

Thanks in Advance

1

1 Answers

0
votes

If your Refresh Token is ever expired, you must get a new Refresh Token by starting the OAuth login flow from the beginning.

Starting with step 2 here: https://developer.box.com/v2.0/docs/oauth-20#section-2-the-first-leg

Make sure that your code listens for the "401 Unauthorized" response from the API and saves the new Refresh Token back to wherever you are initializing your code from.