# GetUserInfoAsync not returning all data for a user

**URL:** <https://community.auth0.com/t/getuserinfoasync-not-returning-all-data-for-a-user/21380>\
**Category:** Get Help\
**Created:** [February 15, 2019, 9:03pm UTC](https://community.auth0.com/t/getuserinfoasync-not-returning-all-data-for-a-user/21380 "2019-02-15T21:03:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![darian](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/darian/32/10289_2.png) [@darian](https://community.auth0.com/u/darian)\
**Post date:** [February 15, 2019, 9:03pm UTC](https://community.auth0.com/t/getuserinfoasync-not-returning-all-data-for-a-user/21380/1 "2019-02-15T21:03:14Z")

</div>

I am trying to get the properties of the currently logged in user after they successfully log in. I am doing this using C# and the AuththenticationApiClient object.

```
var claimsIdentity = User.Identity as ClaimsIdentity;
string accessToken = claimsIdentity?.FindFirst(c => c.Type == "access_token")?.Value;
string idToken = claimsIdentity?.FindFirst(c => c.Type == "id_token")?.Value;

AuthenticationApiClient client = new AuthenticationApiClient(new Uri(string.Format("https://{0}", ConfigurationManager.AppSettings["auth0:Domain"])));
var profile = await client.GetUserInfoAsync(accessToken);

```

The profile object is created with the user, but the firstname and surname properties are returning as null. I have verified that the firstname and surname properties have been set for my user by looking at this information in Auth0 under the Users \> Identity Provider Attributes.

Thoughts as to why these values are null, where as others like the users id, email, and even app\_metadata are returned?

---

<div class="post-metadata">

**Author:** ![nicolas\_sabena](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nicolas_sabena/32/6064_2.png) [@nicolas\_sabena](https://community.auth0.com/u/nicolas_sabena)\
**Post date:** [February 16, 2019, 12:02pm UTC](https://community.auth0.com/t/getuserinfoasync-not-returning-all-data-for-a-user/21380/2 "2019-02-16T12:02:38Z")

</div>

`GetUserInfoAsync` uses OIDC’s `/userinfo` endpoint. In OIDC, the information that gets back to the application both in the ID Token and in the `/userinfo` endpoint are affected by:

- The scope originally requested by the application (`openid`, `profile`, `email`). See [OpenID Connect Scopes](https://auth0.com/docs/scopes/current/oidc-scopes) for more info on that.

- The additional claims added by rules.
- Other custom transformations made by rules (like removing the first name and surname on purpose)

The .Net SDK puts additional claims (those that don’t have a property associated) in the `AdditionalClaims` dictionary. This class shows you how the mapping is done: [auth0.net/UserInfo.cs at master · auth0/auth0.net · GitHub](https://github.com/auth0/auth0.net/blob/master/src/Auth0.AuthenticationApi/Models/UserInfo.cs)

You can also inspect the `idToken` coming from line 3 in the above code snippet and decode it at [https://jwt.io](https://jwt.io). This will show you the claims coming in the ID token (which will contain roughly the same user claims as the user info). If the ID Token has the first name and surname, then something is wrong on the .Net SDK side (maybe the claim doesn’t have the expected name). If the claims are not there, then something is wrong on the server side (e.g. a faulty rule, or incorrect user profile).

If the above doesn’t help, please provide the tenant name, the user ID involved, and a [.HAR file](https://auth0.com/docs/har) capturing the authentication flow.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [August 29, 2019, 11:01am UTC](https://community.auth0.com/t/getuserinfoasync-not-returning-all-data-for-a-user/21380/3 "2019-08-29T11:01:43Z")

</div>

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