We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
giullianoa
9 years agoExplorer | Level 4
Migration token OAuth 1 to Oauth 2
Good Afternoon
I triyed to update my OAuth 1 token to OAuth 2 through this HTTP request :
https://api.dropboxapi.com/2/auth/token/from_oauth1
But the response looks like this :
{"error_summary": "invalid_oauth1_token_info/.", "error": {".tag": "invalid_oauth1_token_info"}}
This kind of error references to the token information ( key:secret ).
The parameter's data is :
$auth = $key.':'.$secret
array("oauth1_token"=>$auth,"oauth1_token_secret"=>$secret);
But the values was correct !( I think so...)
Whats going on ?
14 Replies
Replies have been turned off for this discussion
- Greg-DB9 years ago
Dropbox Community Moderator
To properly call /2/auth/token/from_oauth1, you will need four pieces:
- In the "Authorization" header, as Basic authentication, you need to provide the 1) app key and 2) app secret.
- In the request body, as JSON, you need to provide the 3) oauth1_token, i.e., the OAuth 1 access token key, and 4) oauth1_token_secret, i.e., the OAuth 1 access token secret.
These 4 strings would all be different strings.
Are you sending up all 4 of those?
- giullianoa9 years agoExplorer | Level 4
Thank you for quickly response.
1) Am I need to pass ( appKey: appSecret ) in the Authorization header ?
3) oauth1_token is the appKey ?
4) oauth1_token_secret is the secret ?
My request is made by this way :
- Greg-DB9 years ago
Dropbox Community Moderator
You do need to pass the app key and secret in the Authorization header.
The oauth1_token is not the app key, and the oauth1_token_secret is not the app secret. These all should be different strings.
The oauth1_token is the key portion of the OAuth 1 access token. The oauth1_token_secret is the secret portion of the OAuth 1 access token. You would get these from the stored OAuth 1 access tokens you have for users from when your app was using OAuth 1 on API v1. If your app doesn't have stored OAuth 1 access tokens, you shouldn't be using /2/auth/token/from_oauth1. - giullianoa9 years agoExplorer | Level 4
I have to explain my situation...
I used to use SDK's maded to PHP, but with this nes upgrade with the new update this become obsolete.
What the way i can get to migrate my app ?
I think this https://api.dropboxapi.com/2/auth/token/from_oauth1 is the better way to i can finish the migration.
Can you help me ?
- Greg-DB9 years ago
Dropbox Community Moderator
Are you referring to this PHP SDK?
https://github.com/dropbox/dropbox-sdk-php
That SDK already used OAuth 2, not OAuth 1. If you were using that, you shouldn't have OAuth 1 tokens, so you don't need to use /2/auth/token/from_oauth1. You should just use the existing OAuth 2 access tokens with API v2. - giullianoa9 years agoExplorer | Level 4
Yes thats it.
Howerver in this link " https://www.dropbox.com/developers/documentation " dont appear PHP language.
What I have to change exactly ?
The call of yours new Api ?
I just want to use "getMetadataWithChildren" and "uploadFile", where i have to chage ?
Thank's for your attention in this case.
- giullianoa9 years agoExplorer | Level 4
Forget about it..
I get the access but, has something change in getMetadataWithChildren parameters ?
Every path passed in the parameter return "null".
- Greg-DB9 years ago
Dropbox Community Moderator
The https://www.dropbox.com/developers/documentation link is for the HTTP interface itself.
We don't have plans for an official PHP SDK for Dropbox API v2, but you can use a third party library if you don't want to call the HTTPS endpoints directly:
https://www.dropbox.com/developers/documentation/communitysdks
For reference, to upload files, you can use:
https://www.dropbox.com/developers/documentation/http/documentation#files-upload
To get metadata for a file or folder, you should use:
https://www.dropbox.com/developers/documentation/http/documentation#files-get_metadata
To list the contents of a folder, you should use:
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder
https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder-continue
If you use a third party library instead of these endpoints directly, there should be corresponding methods for each of those. - giullianoa9 years agoExplorer | Level 4
I'm almost done..
When I make upload chunked in the moment to append the existing files already uploaded I got this response :
Unexpected HTTP status 409 {"error_summary": "incorrect_offset/.", "error": {".tag": "incorrect_offset", "correct_offset": 15}}
Why the correct_offset is 15 ?
The operation to calculate the byteOffset is wrong ?
Gratefull to help me in this situation !
- Greg-DB9 years ago
Dropbox Community Moderator
The correct_offset value indicates what byte index in the upload the Dropbox API servers expect next. This may not always match what your app expects, e.g., in cases where the app and server were unable to communicate. For example, if a previous request was received, but the response never made it to the app.
When this happens, you should resume the upload session at the specified offset.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
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!