We Want to Hear From You! What Do You Want to See on the Community? Tell us here!

Forum Discussion

saqib-shafique's avatar
saqib-shafique
Explorer | Level 3
2 years ago

Access Code not working when calling /oauth2/authorize with call back URL

 I have made an API which calls /oauth2/authorize to get access code which is used to get access token and refresh token, since this will be used in an automated process, when I call /oauth2/authorize without callback url, the code I get it works by copying and using in

/oauth2/token, but if I use it with callback URL it always returns "response_body": "{\"error\": \"invalid_grant\", \"error_description\": \"code has already been used\"}".
Call back url(
http://localhost:5000/callback) is configured correctly, otherwise it should not be working when using code manually. 

https://www.dropbox.com/oauth2/authorize?client_id={CLIENT_ID}&token_access_type=offline&response_type=code&redirect_uri={REDIRECT_URI}
"grant_type":"
authorization_code"

any assistance will be really helpful.

1 Reply

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

    Hi saqib-shafique,

    As the error message says, you have tried your code more than once. 🙂 This code is for single time use only. Even more - if not some copy/paste mistake, your URL is incorrect. The ending ("grant_type":"authorization_code") has nothing to do there. If you cannot get in touch/understand with your error, post relevant code snippet letting the mistake reproduction here, so we may comment it. 😉

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,035 PostsLatest Activity: 3 years ago
409 Following

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 or Facebook.

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!