Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
Dearbhla
8 years agoExplorer | Level 3
Migration from v1 to v2 API - automatic token upgrade
Hi I'm wondering about the call to https://api.dropbox.com/1/oauth2/token_from_oauth1 to automatically upgrade a user's token from the v1 to the v2 api. I have this working well in m...
- 8 years ago
You don't need to be already authorized for API v2 to use this endpoint. This endpoint just requires the app key, secret, and OAuth 1 access token (key and secret), not an OAuth 2 access token.
The issue you're running in to is that /2/auth/token/from_oauth1 uses "app authentication" (i.e., you should provide the app key and secret as Basic auth to authorize the HTTP call itself) but you're trying to use "user authentication" (i.e., you're trying to provide a Bearer token to authorize the API call itself). The expected authentication type is a field in the documentation here:
https://www.dropbox.com/developers/documentation/http/documentation#auth-token-from_oauth1
You can find information on the different authentication types, e.g., "app authentication", here:
https://www.dropbox.com/developers/reference/auth-types#app
(This is a bit confusing in this case, since the /2/auth/token/from_oauth1 endpoint expects "app authentication", but also happens to take an access token key/secret as parameters to the API call.)
So, for your HTTP request, you should instead use an Authorization header like this:
Authorization: Basic <base64(APP_KEY:APP_SECRET)>The app authentication documentation elaborates on that example.
We're also working on building this in to SwiftyDropbox itself, but that's not ready quite yet.
Greg-DB
Dropbox Community Moderator
8 years agoYes, that endpoint is considered part of API v1, so it will be retired with API v1.
We have an API v2 equivalent that you can switch to instead though, at /2/auth/token/from_oauth1:
https://www.dropbox.com/developers/documentation/http/documentation#auth-token-from_oauth1
Hope this helps!
We have an API v2 equivalent that you can switch to instead though, at /2/auth/token/from_oauth1:
https://www.dropbox.com/developers/documentation/http/documentation#auth-token-from_oauth1
Hope this helps!
OneLoginAdmin
8 years agoExplorer | Level 3
This endpoint (https://api.dropbox.com/2/auth/token/from_oauth1) is pretending to use old app authentication?
Authorization: Basic <Base64(key:secret)>
Even if is part of APIV2, do I need to configure something on the app to enable V2?
Cause I verified my data and all was good, I have my app_id, app_secret, my oauth_key, and my oauth_secret, but I'm receiving:
invalid_oauth1_token_info
I played with my authorization header, so I could say authorization was good
- Greg-DB8 years ago
Dropbox Community Moderator
OneLoginAdmin I'm not sure I understand what you mean when you say it "is pretending to use old app authentication?". The /2/auth/token/from_oauth1 endpoint is an API v2 endpoint that uses app authentication. That means it requires the app key and secret as Basic credentials, and takes the OAuth 1 access token key and secret as parameters in JSON in the request body.
You don't need to enable anything to use that endpoint. You would just need the four valid distinct values: app key, app secret, OAuth 1 access token key, OAuth 1 access token secret.
The invalid_oauth1_token_info error indicates that the OAuth 1 access token you're supplying is not valid. You only need to use this endpoint if you have old valid OAuth 1 access tokens (i.e., from API v1) that you need to migrate to OAuth 2, e.g., for use with API v2. Where did you get your OAuth 1 access token? Are you sure it's still valid? Please double check that you're sending the correct values. If everything is correct, please share the code that isn't working as expected so we can take a look.
- OneLoginAdmin8 years agoExplorer | Level 3
I'm pretty sure they are valid I just generated them recently and then I hit endpoint using postman:
- Greg-DB8 years ago
Dropbox Community Moderator
Thanks! I just tried this and it appears this endpoint isn't working for Dropbox Business API apps. I'll ask the team to investigate whether or not we can add support for Dropbox Business API apps to this endpoint.
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!