Hi, i'm having problems when deploying my integration to my QA environment, i have already tested it in development and everything was right but i'm getting a totally different response in the route /oauth2/token then what i was receiving during my tests.
The app environments are the same and the code too, so i'm lost over here, any answer could come handy!
Here is how i start my OAUTH flow:
The client will call this route witch should redirect the client to Dropbox authorization page:
async get(req, res) {
const usuario = await Usuario.findByPk(req.params.usuario_id);
return res.redirect(
`https://www.dropbox.com/oauth2/authorize?client_id=${process.env['APP_KEY']}&response_type=code&redirect_uri=${process.env.DROPBOX_WEBHOOK_URL}&token_access_type=offline&state=unidade_id:${usuario.unidade_id}`
);
}
After the user authorizing my app the code bellow is called witch is the code for the route provided in the redirect_uri query param:
async index(req, res) {
const params = new URLSearchParams();
params.append('code', req.query.code);
params.append('client_id', process.env['APP_KEY']);
params.append('client_secret', process.env['APP_SECRET']);
params.append('grant_type', 'authorization_code');
params.append('redirect_uri', process.env.DROPBOX_WEBHOOK_URL);
const fronURLRedirect = new URL(
'/dropbox',
process.env['APP_FRONT_URL']
);
try {
const { data } = await axios.post(
process.env['DROPBOX_OAUTH2_TOKEN_ROUTE'],
params
);
const [_, unidade_id] = req.query.state.split(':');
await AcessoDropbox.create({
...data,
update_token_date: new Date(),
unidade_id,
});
fronURLRedirect.pathname = '/dropbox/sucesso';
return res.redirect(fronURLRedirect.href);
} catch (error) {
console.log(error);
fronURLRedirect.pathname = '/dropbox/erro';
return res.redirect(fronURLRedirect.href);
}
}
And after that our app is successfully authorized, at least during development, here is the return value that i receive from my POST call in the code above in development:

And here is an example of what i receive back in QA with the same code, same app key and secret, the only difference is the redirect_uri:

Here is a full print of my debugging:

I'm also receiving the query params as it should:

It looks like i'm receiving a binary as a response witch is totally different from what i was receiving during my tests, i searched the docs and did some googling but no luck!
My Dropbox app isn't applied to production, i'm wondering if that's the problem.