Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
sr_c
3 years agoExplorer | Level 3
Unable to Retrieve a new short-lived access token through Javascript
Hello, I followed the approach described in below post to get refresh token https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Get-refresh-token-from-access-token/td-p/596739 Through ...
- 3 years ago
That would change the "Content-Type" request header value that you send, but you need to also make sure the value you're sending in the body actually uses that format. That is, you should be formatting the parameters accordingly, not using JSON.stringify. For example, you may want to use URLSearchParams, or whatever functionality you prefer and have available for formatting the parameters accordingly.
Greg-DB
Dropbox Community Moderator
3 years agoThe parameters for the /oauth2/token endpoint should be sent as 'application/x-www-form-urlencoded' POST parameters, not JSON. I see your code is sending them as JSON so the API does not receive them and so the operation fails with that error. Please update your code to send the parameters using the 'application/x-www-form-urlencoded' format.
sr_c
3 years agoExplorer | Level 3
Hello Greg-DB
I tried with below, but the error remains same. Not sure where is the issue.
headers: {
"Content-Type" : "application/x-www-form-urlencoded"
}
Thanks
- Greg-DB3 years ago
Dropbox Community Moderator
That would change the "Content-Type" request header value that you send, but you need to also make sure the value you're sending in the body actually uses that format. That is, you should be formatting the parameters accordingly, not using JSON.stringify. For example, you may want to use URLSearchParams, or whatever functionality you prefer and have available for formatting the parameters accordingly.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!