Auth0 Home Blog Docs

How to get email id as a part of token

scopes

#1

Hi,

How do I get the email address as a part of the Token in the response, it does not have it, and somewhere in the documentation it says to Use scopes but I am not getting a reference on how to use it

I am using Google V7
auth0.login({
connection: ‘google-oauth2’,
}, function(err) {
if (err) alert("something went wrong: " + err.message);
});


#2

To retrieve the email as part of the token, you need to specify the email scope:

auth0.login({
       connection: 'google-oauth2', 
       scope: 'openid email'
     }, 
     function(err) { 
        if (err) alert("something went wrong: " + err.message); 
     });

This is outlined in the Auth0js docs: https://auth0.com/docs/libraries/auth0js/v7


#3