cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more 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: 

Unable to update access token in postman.

Unable to update access token in postman.

Oleks
Explorer | Level 4
Go to solution

Screenshot 2022-10-01 at 10.25.42 AM.pngScreenshot 2022-10-01 at 10.25.52 AM.png

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

I have a post here showing the basic flow of getting and using a refresh token to retrieve new short-lived access tokens on demand which may be helpful.

View solution in original post

5 Replies 5

Greg-DB
Dropbox Staff
Go to solution

I see you're trying to call the /2/auth/token/from_oauth1 endpoint. If this is a new integration, you should not be using that endpoint. This endpoint is only meant for use if you have pre-existing OAuth 1 access tokens, and the oauth1_token and oauth1_token_secret parameters would refer to the old OAuth1 access token key and secret, not your client ID and secret. This endpoint should not be used as part of the current OAuth 2 app authorization flow.
 
OAuth 1 access tokens were a feature of an old version of the Dropbox API. If you've only used API v2 and OAuth 2, you wouldn't have any OAuth 1 access tokens. If you don't have pre-existing OAuth 1 access tokens, for instance, if you're just developing the integration now, you should send the user through the normal OAuth 2 app authorization flow.
 
You can find information on how this works in the OAuth Guide and authorization documentation

Oleks
Explorer | Level 4
Go to solution

Thanks a lot! It would be great to guide how to request a new access token for Oauth2. 

Greg-DB
Dropbox Staff
Go to solution

I have a post here showing the basic flow of getting and using a refresh token to retrieve new short-lived access tokens on demand which may be helpful.

Oleks
Explorer | Level 4
Go to solution

I did it, works perfectly fine. However, looking for a way not to use the terminal. I would love to automate that process. Here is my code: 

const encodedToken = Buffer.from("<client_key>:<client_secret>").toString('base64');

pm.sendRequest({
method: 'POST',
header: {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': `Basic ${encodedToken}`
},
}, function (err, res) {
console.log(res)
return pm.environment.set("OAuth_Token", res.json().access_token);
});

Greg-DB
Dropbox Staff
Go to solution

The sample in my post happens to use curl on the command line, but exactly what network client you use is up to you, depending on your use case, environment, etc.

 

I can't offer help with the third party network clients themselves, but looking at that code, it seems you're missing the rest of the parameters for the /oauth2/token call, such 'grant_type', and 'refresh_token' or 'code', as applicable. You'll need to refer to the documentation and examples to translate that for your network client.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Oleks Explorer | Level 4
What do Dropbox user levels mean?