cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Java dropbox API permanent key

Java dropbox API permanent key

Ricardo W.
New member | Level 1

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 2

Greg-DB
Dropbox Staff

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.
New member | Level 1

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

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Ricardo W. New member | Level 1
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?