Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

Ricardo W.'s avatar
Ricardo W.
New member | Level 1
9 years ago

Java dropbox API permanent key

Hello,

I am for the first time trying to create a APP that will upload a backup file into dropbox and although I managed to get it to work with the code example provided here https://www.dropbox.com/developers-v1/core/start/java the generated code only last for one run, next time it does not work anymore and I need to generate a new code.

How do I get my app (JAVA) to only request approval for my APP once and then be able to always run the app and upload my backup file?

Many Thanks

2 Replies

Replies have been turned off for this discussion
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago

    It sounds like you're referring to the "authorization code", stored as `code` in the tutorial. The authorization code is temporary and can only be used once. The "access token", stored as `accessToken` in the tutorial, doesn't expire, so you can store and re-use that. When the user comes back, you can just retrieve that access token instead of sending them to the authorize URL again.

  • Ricardo W.'s avatar
    Ricardo W.
    New member | Level 1
    9 years ago

    Many thanks Gregory I had failed to see that, if accessToken is valid I don't need to to run the "authorization code" and that the "authorization code" creates accessToken.

    DbxAuthFinish authFinish = webAuth.finish(code);
         String accessToken = authFinish.accessToken;

     

    Stored accessToken in a file and it's all good now.

    Many Thanks for your help

About Dropbox API Support and Feedback

Node avatar for Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.

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!