I'm stuck trying to get a client-side authorization token from Dropbox, I've followed the instructions here and here, but still not getting authorized. As stated in the links provided above I'm suppose to make a request to an end-point as this: https//www.dropbox.com/oauth2/authorize?response_type=...&client_id=...&redirect_uri=..., which I did, but still not getting redirected back with authorization code (based on the authorization flow chosen) that would then be exchange for a bearer access token using this call. The bearer access token is then supposed to be used for all subsequent call.
What I'm I doing wrong here? Also is the way I can provide a permanent authentication without having to call the authorization URL for very request to the API? I've been stuck for this. help please.
Source code
if (process.env) {
const appKey = process.env.REACT_APP_KYUNISTUDIO_APP_KEY;
const appSecretKey = process.env.REACT_APP_KYUNISTUDIO_SECRET_KEY;
const authToken = () => {
const headers = {'Content-Type': 'application/json;charset=utf-8'};
fetch(`https//www.dropbox.com/oauth2/authorize?response_type=token&client_id=<${appKey}>&redirect_uri=http://localhost:3000`, {
method: 'GET',
headers:headers,
})
.then(res => res.json)
.then(data => console.log(data))
.catch(err => console.log(err))
}
authToken();
}