Auth0 Home Blog Docs

Error 403 on auth0.Management

auth0
api
management-api
#1

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


#3

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

#4

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

image

#6

@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.