try {
const bodyData = JSON.stringify({
grant_type: 'password',
username: session.user.name,
password: data.oldPassword,
audience: process.env.AUTH0_IDENTIFIER,
scope: process.env.AUTH0_SCOPE,
client_id: process.env.AUTH0_CLIENT_ID,
client_secret: process.env.AUTH0_CLIENT_SECRET,
});
const response = await axios.post(
`${process.env.AUTH0_ISSUER_BASE_URL}/oauth/token`,
bodyData,
{ headers: headersForm }
);
const { access_token } = response.data;
return res.status(200).json({ access_token });
} catch (error) {
console.log(error);
return res.status(500).json({ error: 'Internal server error' });
}
This is the code and i have followed every step still getting the error