Data: { error: 'access_denied', error_description: 'Unauthorized' }

try {
    const bodyData = JSON.stringify({
      grant_type: 'password',
      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
      { headers: headersForm }

    const { access_token } =;

    return res.status(200).json({ access_token });
  } catch (error) {
    return res.status(500).json({ error: 'Internal server error' });

This is the code and i have followed every step still getting the error

Hey @mrutunjay :wave: Welcome to the community!

Just a quick check, did you enable the password grant for your Auth0 application under the Advanced Settings > Grant Type settings? :thinking:

1 Like