We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
pineapps
7 years agoHelpful | Level 5
OAuth2 access token request - Basic authentication not working
I am trying to integrate Dropbox in my webservice. However I decided to use a direct integration instead of any APIs as I need a limited number of functions only and not used to code object orientate...
- 7 years ago
Thanks! The API is indicating that the request wasn't valid. This particular error message isn't too specific, but it seems to be indicating that the necessary information wasn't given.
Looking through your code, you appear to be sending the parameters as JSON. The /oauth2/token endpoint expects application/x-www-form-urlencoded POST parameters though (with the app key and secret in particular optionally sent in the Authorization header instead).
Please update your code to send the rest of the parameters as application/x-www-form-urlencoded POST parameters instead.
Greg-DB
Dropbox Staff
What is the content of the body for 400 HTTP response? It should contain a more useful error message.
pineapps
7 years agoHelpful | Level 5
Greg K. schrieb:
What is the content of the body for 400 HTTP response? It should contain a more useful error message.
For me however, this is not really useful:
I did a
echo implode($http_response_header);
Returns
HTTP/1.1 400 Bad RequestServer: nginxDate: Fri, 05 Jan 2018 20:33:52 GMTContent-Type: application/jsonConnection: closeX-Dropbox-Request-Id: 864d06461b2bc9f132a4cfa44ca9f2a5X-Frame-Options: DENYContent-Security-Policy: sandbox; frame-ancestors 'none'X-Content-Type-Options: nosniffContent-Disposition: attachment; filename='error'
Maybe, this is more usefull for you :) Thank you in advance!
- Greg-DB7 years agoDropbox StaffThat appears to be the response headers only. Can you print the response body?
- pineapps7 years agoHelpful | Level 5
Greg K. schrieb:
That appears to be the response headers only. Can you print the response body?I managed to get additional information from the HTTP request:
{"url":"https:\/\/api.dropboxapi.com\/oauth2\/token","content_type":"application\/json","http_code":400,"header_size":385,"request_size":350,"filetime":-1,"ssl_verify_result":0,"redirect_count":0,"total_time":0.287188,"namelookup_time":0.004172,"connect_time":0.018384,"pretransfer_time":0.053378,"size_upload":23,"size_download":97,"speed_download":337,"speed_upload":80,"download_content_length":-1,"upload_content_length":23,"starttransfer_time":0.287049,"redirect_time":0,"redirect_url":"","primary_ip":"162.125.66.7","certinfo":[],"primary_port":443,"local_ip":"85.13.153.199","local_port":45981}
Last data received
{"error_description": "No auth function available for given request", "error": "invalid_request"}
- Greg-DB7 years agoDropbox Staff
Thanks! The API is indicating that the request wasn't valid. This particular error message isn't too specific, but it seems to be indicating that the necessary information wasn't given.
Looking through your code, you appear to be sending the parameters as JSON. The /oauth2/token endpoint expects application/x-www-form-urlencoded POST parameters though (with the app key and secret in particular optionally sent in the Authorization header instead).
Please update your code to send the rest of the parameters as application/x-www-form-urlencoded POST parameters instead.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 12 months agoIf 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!