Logging in with email doesn't populate email, it populates name

I’m creating new users using very basic oath2 flow from a rails app. I sign up using email address, and log in fine. I get verification emails. However, the data Auth0 sends to me with the token shows the email in the name field and the email field is blank On first glance, this seems like a bug. Maybe there is some nuance I am missing?

{
       "provider" => "auth0",
            "uid" => "auth0|61d98528cbxxx",
           "info" => {
            "name" => "tester123@xxx.com",
        "nickname" => "tester123",
           "email" => nil,
           "image" => "https://s.gravatar.com/avatar/xxx?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fte.png"
    },
    "credentials" => {
                "token" => "eyJhbGcixxx",
           "expires_at" => 1641731795,
              "expires" => true,
             "id_token" => "eyxxx",
           "token_type" => "Bearer",
        "refresh_token" => nil
    },
          "extra" => {
        "raw_info" => {
              "nickname" => "tester123",
                  "name" => "tester123@xxx.com",
               "picture" => "https://s.gravatar.com/avatar/xxx?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fte.png",
            "updated_at" => "2022-01-08T12:35:52.634Z",
                   "iss" => "https://dev-xxx.us.auth0.com/",
                   "sub" => "auth0|61d98528cb5b3exxx",
                   "aud" => "nC2lO76sdxU3mZkBlD0xxx",
                   "iat" => 1641645395,
                   "exp" => 1641681395,
                 "nonce" => "744f45bc354023ac452xxx"
        }
    }
}
{
        "name" => "tester123@xxx.com",
    "nickname" => "tester123",
       "email" => nil,
       "image" => "https://s.gravatar.com/avatar/xxx?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fte.png"
}

Hi @john25,

Thanks for reaching out to the Auth0 Community!

I understand that you’ve observed a scenario where the token you inspect does not have the email in the token and the name property is populated with the email address.

First, to get the email attribute in the token, you will need to specify the email scope in your /authorize request. See this doc for extra details.

Then, to populate the name field with something other than the email address, you must allow the user to specify this attribute on sign up. To do so, you will need to use the additionalSignupFields in your Universal Login Page.

Once you have done so, you will see the email and name in the token populated correctly.

Please let me know if you have any questions.

Thanks!

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