You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

kennyroyelphej's avatar
kennyroyelphej
New member | Level 2
7 months ago

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.

  • Здравко's avatar
    Здравко
    Legendary | Level 20

    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.