cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We are making some updates so the Community might be down for a few hours on Monday the 11th of November. Apologies for the inconvenience and thank you for your patience. You can find out more here.

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unable to acquire refresh token

Unable to acquire refresh token

Steven_R
Explorer | Level 3
Go to solution

Our system already successfully acquires a short lived token, but I want to get a refresh token for Dropbox. We successfully use refresh tokens with systems like SharePoint so are familiar with the flow.

 

Our app has full access to Dropbox (not just the App Folder) so I am not sure if that is the problem, but we get this error from dropbox when we attempt to get the token:

 

invalid_request : unknown field "token_access_type"

 

This is the request that is made

https://api.dropboxapi.com/oauth2/token?client_id=<DropBoxClientId>&client_secret=<DropBoxClientSecret>&redirect_uri=<RedirectURL>&code=<AccessCode>&token_access_type=offline&grant_type=authorization_code

 

If we call it without token_access_type=offline then it works fine, but we only get a short lived token and no refresh token.

 

Are refresh tokens only available if you are accessing the App Folder only? Am I not calling it correctly?

1 Accepted Solution

Accepted Solutions

Здравко
Legendary | Level 20
Go to solution

Hi @Steven_R,

As far as I can see, you are trying authorization by code and mix two different access points calls involved in the auth flow in use - /oauth2/authorize and /oauth2/token. "token_access_type" is valid and usable in the first call, not the second one! 😉 That's where resides your error. On possible results for the second call you can see:


refresh_token String If the token_access_type was set to offline when calling /oauth2/authorize, then response will include a refresh token. This refresh token is long-lived and won't expire automatically. It can be stored and re-used multiple times.


Make a note on meaning for "was" and "when" above. 🙂 Read more carefully documentation.

Hope this helps.

View solution in original post

3 Replies 3

Здравко
Legendary | Level 20
Go to solution

Hi @Steven_R,

As far as I can see, you are trying authorization by code and mix two different access points calls involved in the auth flow in use - /oauth2/authorize and /oauth2/token. "token_access_type" is valid and usable in the first call, not the second one! 😉 That's where resides your error. On possible results for the second call you can see:


refresh_token String If the token_access_type was set to offline when calling /oauth2/authorize, then response will include a refresh token. This refresh token is long-lived and won't expire automatically. It can be stored and re-used multiple times.


Make a note on meaning for "was" and "when" above. 🙂 Read more carefully documentation.

Hope this helps.

Greg-DB
Dropbox Staff
Go to solution

@Steven_R Здравко is correct. The 'token_access_type' parameter is only used on /oauth2/authorize, not /oauth2/token. This is unrelated to the app's access type (full Dropbox versus app folder).

Steven_R
Explorer | Level 3
Go to solution

Thanks I have included the parameter at the correct time and it now works.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Steven_R Explorer | Level 3
  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?