Hello, I have been struggling a bit with getting a refresh token or any success response at all from the endpoint 'https://api.dropboxapi.com/oauth2/token' when following the guide here https://developers.dropbox.com/oauth-guide.
While the docs show all curl requests, I am attempting to make my request currently from postman, but in the end I would like to do this via a standard fetch request if possible.
However, when making requests to the endpoint above, I always am returned the response
{
"error": "invalid_request",
"error_description": "The request parameters do not match any of the supported authorization flows. Please refer to the API documentation for the correct parameters."
}Here is one example of my request:
var details = {
'code': 'REDACTED',
'grant_type': 'authorization_code',
'REDACTED': 'REDACTED'
};
var formBody = [];
for (var property in details) {
var encodedKey = encodeURIComponent(property);
var encodedValue = encodeURIComponent(details[property]);
formBody.push(encodedKey + "=" + encodedValue);
}
formBody = formBody.join("&");
fetch('https://api.dropboxapi.com/oauth2/token', {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
},
body: formBody
}).then(function(response) {
return response.json()
}).then(function(data) {
console.log(data);
})
Here is my postman version
.png)
.png)
For the sections covered in red or 'REDACTED':
The code I am getting via this URL https://www.dropbox.com/oauth2/authorize?client_id=REDACTED&response_type=code&token_access_type=offline
The lowest section is my app key and app secret (in that order).
Is it possible to make this POST request to this endpoint in the way I am trying?
If so, is it possible to see an example somewhere in the docs that is not a curl request? // or point me in the direction of what I am not doing correctly by chance?
Edit: I should also note that this account has purchased 'Teams'.
Thanks in advance!