cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you an educator? Well we want to hear from you, so check out some tools we think might help you out 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 OAuth2 access token from OAuth1 token and secret with API v2 JDK

How to get OAuth2 access token from OAuth1 token and secret with API v2 JDK

Rajarshi
New member | Level 2

 

String my_app_key = "test1234";
String my_app_secret = "test567";
String client_app_key = "cltest123";
String client_app_secret = "cltest456";
 
DbxAppInfo appInfo = new DbxAppInfo(my_app_key, my_app_secret);
DbxOAuth1AccessToken oauth1AccessToken =
new DbxOAuth1AccessToken(client_app_key, client_app_secret);
 
DbxRequestConfig requestConfig = new DbxRequestConfig("myappname");
DbxOAuth1Upgrader upgrader = new DbxOAuth1Upgrader(requestConfig, appInfo);
String s = upgrader.createOAuth2AccessToken(oauth1AccessToken);
System.out.println("s====== " + s);

 

This is my code to fetch accesstoken key from V1.I am getting error of

"unexpected HTTP status code: 403: {"error": "Access token does not belong to this app."}"

 

Please help me out.

2 Replies 2

Re: How to get OAuth2 access token from OAuth1 token and secret with API v2 JDK

Greg-DB
Dropboxer
This error message indicates that the access token you're using (client_app_key and client_app_secret in your code) doesn't correspond to the app key and secret (my_app_key and my_app_secret in your code) that you're using.

When making this case, these pairs needs to match. That is, the access token you're trying to upgrade must have originally been retrieved using an app key and secret for the same app as you're using now.

So in this case, you'll need to swap in the correct app key and secret (my_app_key and my_app_secret in your code) to be able to upgrade this access token (client_app_key and client_app_secret in your code).

Re: How to get OAuth2 access token from OAuth1 token and secret with API v2 JDK

Rajarshi
New member | Level 2

Thank You very very much Greg. It's really help.

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    Rajarshi New member | Level 2
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?