We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.
Forum Discussion
Vladimir V.1
8 years agoExplorer | Level 4
Authorization code flow no longer works?
I am posting all required parameters to https://api.dropboxapi.com/oauth2/token but the servers keeps returning a very vague error: REQUEST: POST https://api.dropbox.com/oauth2/token HTTP/1.1...
- 8 years ago
Thanks for the report! The request payload for /oauth2/token is expected to be delivered with a content type of "application/x-www-form-urlencoded", per RFC 6749 Section 4.1.3. It's possible we may have also been accepting "application/json" though. We'll look into it, but in the meantime, you can switch to "application/x-www-form-urlencoded", which I've confirmed is working as expected.
Also, for reference, but api.dropbox.com and api.dropboxapi.com are supported for this endpoint.
Greg-DB
8 years agoDropbox Staff
Thanks for the report! The request payload for /oauth2/token is expected to be delivered with a content type of "application/x-www-form-urlencoded", per RFC 6749 Section 4.1.3. It's possible we may have also been accepting "application/json" though. We'll look into it, but in the meantime, you can switch to "application/x-www-form-urlencoded", which I've confirmed is working as expected.
Also, for reference, but api.dropbox.com and api.dropboxapi.com are supported for this endpoint.
- Greg-DB8 years agoDropbox StaffI can't seem to find if/when we accepted JSON on this endpoint. Are you sure this previously worked with that content type?
In any case, x-www-form-urlencoded is the right way to call this. Is that working for you?- Vladimir V.18 years agoExplorer | Level 4
Hi Greg,
I think you are right, I recently updated a large chunk of the code when I migrated my plugin from API v1 to v2. The v2 documentation states that RPC enpoints on the api.dropboxapi.com domain accept arguments as JSON in the request body. For that reason I made all API calls to submit the payload in JSON, and that is where the code flow stopped working (which I didn't notice immediately). Either the documentation needs to be very explicit about the expected content type of that call, or the backend needs to be updated to accept JSON and thus provide claimed consistency. If I had a choice I'd go for option #2 as there is probably no valid reason for that particular endpoint not to recognize JSON.
Anyway, thanks for your prompt attention to this issue, I got the code working by reverting the call to form-urlencoded format.
- Greg-DB8 years agoDropbox StaffThanks for confirming that. I'm glad to hear this is sorted out.
The OAuth endpoints are a little different than the API endpoints, so I'll ask the team to clarify the documentation at least.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,875 PostsLatest Activity: 5 hours 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!