Auth0 Home Blog Docs

/userinfo endpoint is not returning email

#1

I am calling the /userinfo endpoint outlined here: https://auth0.com/docs/api/authentication#get-user-info in order to get the user info for an access_token, however the data I’m getting back does not include the email. Here is what I am getting:

{“sub”:“auth0|5c83de3eeafe76233271ccbd”,“nickname”:“wadebxxxxx”,“name”:“wadebxxxxxx@xxxxxx.com”,“picture”:“https://s.gravatar.com/avatar/61fdca71f6c7b03f97a12f9eb896a9bc?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fwa.png",“updated_at”:"2019-03-12T09:29:48.320Z”}

Any ideas?

(PS: The main reason I am calling this is because I am calling my ASPNet Core web api with the access_token from my mobile app. The User in ASPNet Core does not have any of the normal user data that it would when coming in from the html site, so I might be doing other things improperly as well here).

#2

Hey there @wadeb!

Are you sure you have defined the correct scope to get email?

Here’s more on that:

That’s probably the root cause here. Try setting scope to openid email

#4

Thanks Konrad,

I thought I had to specify the scopes on the apis, but now I see I have to do it on the authorization request. Thanks!

1 Like
#5

No worries :slight_smile: Glad you were finally able to make it!

#6

I was having a similar problem with Ruby on Rails (after following the Auth0 quickstart). I’m not sure what the reasoning of the quickstart author was for leaving out the “email” scope, but it resulted in a behavior that looked like a bug (userinfo null email field).

The solution for Ruby on Rails was to add “email” to the scope: line in auth0.rb initializer.

I highly imagine that most apps outsourcing their user auth/management would want to see the users’ email addresses, so I think the quickstart should be updated to include the email scope.

1 Like
#7

Thanks a lot @admin33! I’ll make sure to relay that feedback to appropriate team!

closed #8

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.