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: 

Generation access token for V2 using V1 access key and secret key

Generation access token for V2 using V1 access key and secret key

RDev
New member | Level 2

Hi

I have been trying to generate oauth 2 access token for my app (which was created using core api 1 in java), based on the documentation provided for migration but every time I tried it I got

{"error": "Invalid app key (consumer key). Check your app's configuration to make sure everything is correct."}.

 

I tried both the sdk approach as well as the http one but to no avail.I am stuck . Kindly need help to figure out where am  I going wrong with this.  Below code is the one I used to fetch oauth2.0 token. Here  is the java approach I tried

 DbxOAuth1Upgrader upgrader;
            DbxOAuth1AccessToken oAuth1AccessToken;

            DbxRequestConfig requestConfig = new DbxRequestConfig(appName);
            DbxAppInfo appInfo = new DbxAppInfo(accessKey, secretKey);
            upgrader = new DbxOAuth1Upgrader(requestConfig, appInfo);
            oAuth1AccessToken = new DbxOAuth1AccessToken(accessKey, secretKey);

            String newToken = upgrader.createOAuth2AccessToken(oAuth1AccessToken);
            upgrader.disableOAuth1AccessToken(oAuth1AccessToken);

 

The same accesskey and secretKey are working fine with the coreAPI 1.

 

1 Reply 1

Greg-DB
Dropbox Staff

You're using the same accessKey/secretKey pair for both your app info and access token. These should actually be different pairs of strings. The app key and secret (a.k.a. consumer key and secret) identify your app. They can be found on the app's page on the App Console. The access token key and secret are different strings that are specific to the user.

 

So, these two lines should look like this, with the correct and distinct values for each of the four parameter variables:

 

DbxAppInfo appInfo = new DbxAppInfo(appKey, appSecret);
oAuth1AccessToken = new DbxOAuth1AccessToken(oauth1AccessTokenKey, oauth1AccessTokenSecret);
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?