We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
Chan N.
11 years agoNew member | Level 1
authenticating your app (code has expired error)
Hi there,
I am following the steps mentioned here https://www.dropbox.com/developers/core/start/java. but when I run the java program for second time, it says that "code has expired (within the las...
Greg-DB
Dropbox Community Moderator
11 years agoChan, You're getting this error because each "authorization code" that you exchange for the access token is short-lived (just a few minutes) and can only be used once, so you can only use each one once, soon after retrieving it.
After that, you can just store and re-use the resulting access token that your app receives from the app authorization flow for each account. These access tokens don't expire automatically (though they can be manually revoked) so your app can re-use them without manual user intervention.
And yes, you can set this up to work without the manual/copy paste. The tutorial uses the flow without a redirect URI, but instead, for web apps, you'll want to use DbxWebAuth:
https://dropbox.github.io/dropbox-sdk-java/api-docs/v1.7.x/com/dropbox/core/DbxWebAuth.html
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!