cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more 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: 

how to get access token using refresh token in java

how to get access token using refresh token in java

sanjeev_hansanur1
Explorer | Level 4

I have refresh token(constant), need to know how to obtain access token using refresh token in java

 

Need sample code to test

4 Replies 4

Здравко
Legendary | Level 20

Hi @sanjeev_hansanur1,

There are some examples where you can select from to test or get idea. You don't need access token directly since Dropbox Java SDK takes care about it. To create client object you need to create DbxCredential object (for accessToken set some arbitrary string and for expiresAt set zero). Depending on selected OAuth method (when you got your refresh token) you may need other DbxCredential constructor to success (appSecret in addition). At the end create a DbxClientV2 object and use it as you want to. 😉 That's it.

Hope this helps.

Greg-DB
Dropbox Staff

You can also find examples of this functionality in the Dropbox API v2 Java SDK here.

 

For Android apps in particular, if relevant in your case, using the official Dropbox API v2 Java SDK, you should use the updated authorization functionality, starting with the startOAuth2PKCE method. You can find an example app here. For instance, you can see where that starts in the code here and how the result is handled here. When you use that functionality as shown, the SDK will then handle the refresh process for you automatically.)

--

Edit: updated links.

Abood Moorad
New member | Level 2

Can you update the links because they are not valid anymore

Greg-DB
Dropbox Staff

@Abood Moorad I've updated the links in my post. Thanks!

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Abood Moorad New member | Level 2
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?