l try to get access token uses javascript fetch in the next way:
fetch('https://api.dropboxapi.com/oauth2/token', {
method: 'POST',
code: AUTHORIZATION_CODE,
grant_type: 'authorization_code',
redirect_uri: `${REDIRECT_URI}${window.location.pathname}`,
headers: {
'Content-Type': "application/x-www-form-urlencoded"
},
CLIENT_ID: CLIENT_SECRET
})
.then(res => res.json())
.then(data => console.log('access data =>', data))
.catch(err => console.log('access err =>',err));
I receive AUTHORIZATION_CODE after successful redirecting from "https://www.dropbox.com/oauth2/authorize..." domain.
But I have an err like
{"error_description": "No auth function available for given request", "error": "invalid_request"}
What am I doing wrong? Because I follow curl request example from here: https://www.dropbox.com/developers/documentation/http/documentation#oauth2-token
curl https://api.dropbox.com/oauth2/token \
-d code=<AUTHORIZATION_CODE> \
-d grant_type=authorization_code \
-d redirect_uri=<REDIRECT_URI> \
-u <APP_KEY>:<APP_SECRET>
Thanks!