You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

Gelembjuk's avatar
Gelembjuk
Helpful | Level 5
5 years ago

Dropbox oAuth2 auth process fails with 400 Bad Request when call /oauth2/token

I have got the problem with my app.

It worked fine for long time and now somethign happend. I can not understand what is wrong here.

 

The problem is with oauth2 auth process.

The first step works fine. I call https://www.dropbox.com/oauth2/authorize  with my client_id, redirect_url (it is registered in the app).

User approves access and dropbox redirects me back to the redirect_url and there is the code argument (access code).

 

When i call /oauth2/token to exchance this code for the access token , i have the http 400 error.

 

2020-11-04 08:19:43

> POST /oauth2/token HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 5.1) Chrome/23.0.1271.95 Safari/537.11
Host: api.dropboxapi.com
Accept: application/x-ms-application, image/gif, application/xaml+xml, *\/*
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Mozilla/5.0 (Windows; U; Windows NT 5.1; uk; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
Content-Length: 223

grant_type=authorization_code&code=Vwb***EU_yE&client_id=7cor***3&client_secret=******&redirect_uri=https%3A%2F%2Fdev7-roman-web1.*****.com%2Fdropbox_oauthcalback.htm

* upload completely sent off: 223 out of 223 bytes
< HTTP/1.1 400 Bad Request
< Content-Length: 11
< Content-Type: text/plain
< Date: Wed, 04 Nov 2020 08:19:10 GMT
< Server: envoy
< Connection: close
<
* Closing connection 12

Bad Request

WHat can be wrong with it? any idea?

  • Ok. Other possible reason of my problem is that there was wrong User-Agent string n the request (second line from bottom)

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,877 PostsLatest Activity: 4 hours ago
325 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!