cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Not happy with your Spotify Wrapped? Check out how Kevin on the Dropbox team used Paper to make sure he keeps discovering new music over 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: 
1
Ask
2
Reply and help

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

Re: Java dropbox API permanent key

Greg-DB
Dropboxer

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.

Re: Java dropbox API permanent key

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

Who's talking

Top contributors to this post

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