Forum Discussion

giullianoa's avatar
giullianoa
Explorer | Level 4
8 years ago

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 ?

 

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    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?

    • giullianoa's avatar
      giullianoa
      Explorer | 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-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff
        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.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,950 PostsLatest Activity: 2 hours ago
352 Following

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 or Facebook.

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!