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