Unable to get user email id after authentication

I’m following this article , repo and things are great so far until I was trying to get user’s email ID. I tried adding “email” scope in the auth-service.js file & tried to retrieve this email id same way username & profile picture fields were done to get in home.js, adding supporting code:

webContents.on('dom-ready', () => {
  const profile = authService.getProfile();
  user_name = document.getElementById('name').innerText = profile.name;
  user_email =  document.getElementById('email').innerText = profile.email;
});

but got email-id undefined :frowning:
Am I missing anything here? please help me out from this @konrad.sopala , @dan.woda & @rueben.tiow
Thank you :slight_smile:

Hi @ShubhamMetkar,

What are you seeing in the profile object?

Hello @dan.woda , thank you for replying back,
So this is what I got in profile object:
{
given_name: ‘SHUBHAM’,
family_name: ‘METKAR’,
nickname: ‘2018.shubham.metkar’,
name: ‘SHUBHAM METKAR’,
picture: ‘https://lh3.googleusercontent.com/a-/AOh14GjJKt9jjk2skD6lhwYJw_OEPAqhm_KtegpAI8aN=s96-c’,
locale: ‘en’,
updated_at: ‘2022-03-29T16:57:29.640Z’,
iss: ‘https://dev-3vgs7bqd.us.auth0.com/’,
sub: ‘google-oauth2|107581881026254675326’,
aud: ‘ePEaP1W8vo6qysq98F4vw9DXwVtW0MYU’,
iat: 1649218462,
exp: 1649254462
}

Hello @Moore69 , seems like links haven’t been added in the comment by you. Also it would be great if you could see the repo/article & then provide more specific solution/inputs regarding user email id.
Thank you :slight_smile:

@ShubhamMetkar,

That appeared to be a spam user, apologies!

Can you please share how you are adding the email scope to the request? It appears that is the missing piece here.

Hello @dan.woda , I’m little surprised as I didn’t change anything in the code but all of sudden since today I started getting the email id in the object which is like this:
{
given_name: ‘SHUBHAM’,
family_name: ‘METKAR’,
nickname: ‘2018.shubham.metkar’,
name: ‘SHUBHAM METKAR’,
picture: ‘https://lh3.googleusercontent.com/a-/AOh14GjJKt9jjk2skD6lhwYJw_OEPAqhm_KtegpAI8aN=s96-c’,
locale: ‘en’,
updated_at: ‘2022-04-06T08:24:14.308Z’,
email: ‘2018.shubham.metkar@ves.ac.in’,
email_verified: true,
iss: ‘https://dev-3vgs7bqd.us.auth0.com/’,
sub: ‘google-oauth2|107581881026254675326’,
aud: ‘ePEaP1W8vo6qysq98F4vw9DXwVtW0MYU’,
iat: 1649416108,
exp: 1649452108
}

Nevermind, some strange situations in software development😅
I’ll ping you in future if at all I get any error.
Thank you for your time :slight_smile:

1 Like

Sounds good. I’m going to mark this as resolved. Feel free to open a new topic if you see this issue again.

Thanks!