We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
JustADev
4 years agoNew member | Level 2
oauth2/token endpoint not returning refresh_token
My app starts the oauth flow with a URL like this:
https://www.dropbox.com/oauth2/authorize?response_type=code&client_id=<APP_CODE>&token_access_type=offline
After the user authorizes the...
Greg-DB
Dropbox Community Moderator
4 years ago[Cross-linking for reference: https://stackoverflow.com/questions/73155941/dropbox-oauth2-token-endpoint-not-returning-refresh-token ]
I just checked and this is working for me:
# https://www.dropbox.com/oauth2/authorize?response_type=code&client_id=u1v<redacted>&token_access_type=offline
# resulted in:
# Access Code Generated
# Enter this code into <redacted> to finish the process
# Zu9U1<redacted>
curl -X POST https://www.dropbox.com/oauth2/token \
-d code=Zu9U1<redacted> \
-d grant_type=authorization_code \
-d client_id=u1v<redacted> \
-d client_secret=<redacted>
{"access_token": "sl.BMQ<redacted>", "token_type": "bearer", "expires_in": 14400, "refresh_token": "_Ql10<redacted>", "scope": "account_info.read file_requests.read files.content.read files.content.write files.metadata.read files.metadata.write sharing.read sharing.write", "uid": "225<redacted>", "account_id": "dbid:AAB<redacted>"}
The JSON result from /oauth2/token contains a "refresh_token" field with the refresh token string. How are you checking the returned payload for the refresh token?
If this isn't working for you, please show the actual /oauth2/authorize authorization and /oauth2/token request and response (just redacting private values).
AEC_IT
4 years agoExplorer | Level 4
Hello!
I'm having an issue with the 'offline' token. I went thru the process of requesting a refresh token using the web link: https://www.dropbox.com/oauth2/authorize?client_id=<redacted>&token_access_type=offline&response_type=code and received the following (expired token):
I then ran the cURL
https://api.dropboxapi.com/oauth2/token
-X POST
-d code=<Same as above> \
-d grant_type=authorization_code \
-d client_id=<redacted> \
-d client_secret=<redacted>
And received this JSON Reply
{
"access_token": "sl.BQYCf_C1xmJomo<redacted>",
"account_id": "dbid:AAA<redacted>",
"expires_in": 14400,
"refresh_token": "NlNyjWipw-wAAA<redacted>",
"scope": "account_info.read account_info.write contacts.read contacts.write file_requests.read file_requests.write files.content.read files.content.write files.metadata.read files.metadata.write sharing.read sharing.write",
"token_type": "bearer",
"uid": "<redacted>"
}
I successfully obtain the new token however that token expired in 14400 seconds (4 hours). I am not sure how to get a 'refreshed' token as the "refresh_token" doesn't work in place of the web obtained refresh token. What am I doing wrong/or need to do to get a offline token? (My FM solution needs to continually talk to DB and this app is exclusively for this purpose and no external usage/request outside this link would be used.)
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!