Error 403 on auth0.Management

I’m trying to get the user’s profile using auth0.Management API
and I’ve been getting error 403 here’s my code below

const a0 = new auth0.WebAuth({
  domain: process.env.AUTH0_DOMAIN,
  clientID: process.env.AUTH0_CLIENT_ID,
  responseType: 'token id_token',
  scope: 'openid profile email',
  redirectUri: window.location.href,
});

export function getUserUsingManagementApi() {
  a0.checkSession(
    {
      audience: 'https://' + process.env.AUTH0_DOMAIN + '/api/v2/',
      scope: 'read:current_user',
    },
    function(err, result) {
      if (!err) {
        const auth0Manage = new auth0.Management({
          domain: process.env.AUTH0_DOMAIN,
          token: result.accessToken,
        });
        auth0Manage.getUser(result.idTokenPayload.sub, (err, userInfo) => {
          console.log('GET USER', err, userInfo);
        });
      }
      else {
        // handle error
      }
    }
  );
}
  • So I need this information to display at my user’s page and allow them to update their Name & Email


Hi @lucas2,

Welcome to the Auth0 Community!

Is there an error message associated with the 403? It looks like it is cut off in the screen cap you linked.

Thanks,
Dan

Hi @dan.woda no that’s all of it. I just hovered to the error, any ideas?

image

@lucas2,

Would you be able to DM me a Har file? Make sure to remove sensitive data from the file. I am interested in looking at the token you are using.