Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
Jay_Nuggehalli
9 years agoExplorer | Level 3
Do not get 'oauth1AccessSecret' while using OAuth V1
We are currenlty migrating API v1 to v2. While doing so we wanted to upgrade the tokens of our existing users but one of the required parameters to do so 'access secret' is missing in the v1 response...
- 9 years agoIf your access tokens don't have a separate "secret" portion, it sounds like you already have OAuth 2 access tokens.
Note that API v1 supports both OAuth 1 and OAuth 2 (whereas API v2 only supports OAuth 2), so you may already have been using OAuth 2 access tokens with API v1.
In that case, you don't need to migrate these tokens, and can directly use them with API v2.
Greg-DB
Dropbox Community Moderator
9 years agoHi Jay, it looks like you're using the /1/oauth2/token_from_oauth1 endpoint to get an OAuth 2 access token from an OAuth 1 access token.
Based on the response you shared, that's working correctly. The "access_token" value there is the OAuth 2 access token.
OAuth 2 access tokens are different from OAuth 1 access tokens in that OAuth 2 access tokens only have one part, whereas OAuth 1 access tokens have two parts (a key and secret).
Once you have this OAuth 2 access token, you can use it to call both API v1 and API v2 using the OAuth 2 protocol for bearer tokens. I.e., you can just add an "Authorization" header with value "Bearer ACCESS_TOKEN_HERE".
Jay_Nuggehalli
9 years agoExplorer | Level 3
We currenlty have a bunch of dropbox user tokens using the V1 API.
When we used V1 API to get the access token we were not getting "access token secret" from the response.
Apparently, this "access token secret" is required by the Dropbox SDK to migrate V1 access token to V2 access token.
Also as already mentioned we are trying to use the Dropbox Java SDK 2.1.2 to perform the migration of access token.
Please find the code snippet below:
private String upgradeAccessTokenV1ToV2(String accessToken_V1) {
DbxOAuth1AccessToken oauth1AccessToken = new DbxOAuth1AccessToken(
accessToken_V1, "SECRET_NOT_AVAILABLE");
DbxAppInfo appInfo = new DbxAppInfo(config.getClientId(), config.getClientSecret());
// Get an OAuth 2 access token.
DbxRequestConfig requestConfig = new DbxRequestConfig(clientIdentifier);
DbxOAuth1Upgrader upgrader = new DbxOAuth1Upgrader(requestConfig,appInfo);
String oauth2AccessToken = "";
try {
oauth2AccessToken = upgrader
.createOAuth2AccessToken(oauth1AccessToken);
System.out.println("OAuth 2 access token obtained.");
} catch (DbxException ex) {
System.err.println("Error getting OAuth 2 access token: "
+ ex.getMessage());
}
return oauth2AccessToken;
}
As mentioned in the earlier post we do not get the Oauth version 1 token secret from the v1 API to plug in "SECRET_NOT_AVAILABLE"
- Greg-DB9 years ago
Dropbox Community Moderator
If your access tokens don't have a separate "secret" portion, it sounds like you already have OAuth 2 access tokens.
Note that API v1 supports both OAuth 1 and OAuth 2 (whereas API v2 only supports OAuth 2), so you may already have been using OAuth 2 access tokens with API v1.
In that case, you don't need to migrate these tokens, and can directly use them with API v2.
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!