Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

kennyroyelphej's avatar
kennyroyelphej
New member | Level 2
2 years ago
Solved

Dropbox Error: Invalid Access Token, Unable to get Temporary Upload and Download Links

Greetings,

I have created a web app that allows users to upload and download their documents to Dropbox in the Apps/MY_APP_FOLDER directory. I have their refresh_token and can generate the access_token. While this access token allows access to user details, I am currently unable to generate a temporary upload and download link.

`curl https://api.dropbox.com/oauth2/token \
    -d refresh_token=user_refresh_token \
    -d grant_type=refresh_token \
    -d client_id=app_key \
    -d client_secret=app_secert`

`curl -X POST https://api.dropboxapi.com/2/files/get_temporary_upload_link \
    --header "Authorization: Bearer user_access_token" \
    --header "Content-Type: application/json" \
    --data "{\"commit_info\":{\"autorename\":true,\"mode\":\"add\",\"mute\":false,\"path\":\"/Sample.pdf\",\"strict_conflict\":false},\"duration\":3600}"`

`curl -X POST https://api.dropboxapi.com/2/files/get_temporary_link \
    --header "Authorization: Bearer user_access_token" \
    --header "Content-Type: application/json" \
    --data "{\"path\":\"/Sample.pdf\"}"`

Error:
`{"error":{".tag":"invalid_access_token"},"error_summary":"invalid_access_token/"}`

Could someone please guide me on how to resolve this issue? Any assistance would be greatly appreciated.

References:
1. https://developers.dropbox.com/oauth-guide
2. https://dropbox.tech/developers/using-oauth-2-0-with-offline-access
3. https://www.dropbox.com/developers/documentation/http/documentation#files-get_temporary_upload_link
4. https://www.dropbox.com/developers/documentation/http/documentation#files-get_temporary_link


  • kennyroyelphej wrote:

    ... I have their refresh_token and can generate the access_token. ...

    ...

    Error:
    `{"error":{".tag":"invalid_access_token"},"error_summary":"invalid_access_token/"}`

    ...


    Hi kennyroyelphej,

    The error message shows that the access token is not generated as needed or maybe it's not valid anymore (has expired already). Did you organize your token flow/generation/refresh as shown here? 🧐 If not, give it a try and repeat your calls in this context. 😉 Does the same error message appear?

    Hope this helps.

1 Reply

Replies have been turned off for this discussion
  • Здравко's avatar
    Здравко
    Legendary | Level 20
    2 years ago

    kennyroyelphej wrote:

    ... I have their refresh_token and can generate the access_token. ...

    ...

    Error:
    `{"error":{".tag":"invalid_access_token"},"error_summary":"invalid_access_token/"}`

    ...


    Hi kennyroyelphej,

    The error message shows that the access token is not generated as needed or maybe it's not valid anymore (has expired already). Did you organize your token flow/generation/refresh as shown here? 🧐 If not, give it a try and repeat your calls in this context. 😉 Does the same error message appear?

    Hope this helps.

About Dropbox API Support & Feedback

Node avatar for 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!