Auth0 Home Blog Docs

Auth0 get userinfo 401 error


#1

I use auth0-js
this.auth0 = new auth0.WebAuth({
clientID: this.config.getConfig().auth.clientID,
domain: this.config.getConfig().auth.domain,
responseType: ‘token id_token’,
audience: this.config.getConfig().auth.audience,
redirectUri: this.config.getConfig().auth.redirectUri,
scope: ‘offline_access openid profile’
});

when I log in with username password
this.auth0.login({
realm: ‘Username-Password-Authentication’,
username,
password,
}

and then get user profile
this.auth0.client.userInfo(accessToken, (err, profile) => {
if (profile) {
self.userProfile = profile;
}
cb(err, profile);
});

its all ok,
but when I try to login with salesforce

loginSF(): void {
this.auth0.authorize({
connection: ‘salesforce’,
responseType: ‘token id_token’,
scope: ‘offline_access openid profile contacts’
});

and try to get userinfo I have error 401, what I`m missing?
token is valid, I can use it in api etc, but userinfo not getting