# Username is not populating in auth0 drupal module

**URL:** <https://community.auth0.com/t/username-is-not-populating-in-auth0-drupal-module/37913>\
**Category:** Get Help\
**Created:** [February 14, 2020, 1:29pm UTC](https://community.auth0.com/t/username-is-not-populating-in-auth0-drupal-module/37913 "2020-02-14T13:29:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![moneesh.koundal](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/moneesh.koundal/32/19171_2.png) [@moneesh.koundal](https://community.auth0.com/u/moneesh.koundal)\
**Post date:** [February 14, 2020, 1:29pm UTC](https://community.auth0.com/t/username-is-not-populating-in-auth0-drupal-module/37913/1 "2020-02-14T13:29:10Z")

</div>

Hi,

We are using auth0 drupal 8 modules in our site but when user register in auth0 and then user gets redirected to the drupal site on auth0/callback url with state and token.

Then callback to user info is made but api is not returning the username. please let us know how to get username in user api.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/3/4/3457106995bdcc9ee5c79704b7b7d93dde909ded.png)

---

<div class="post-metadata">

**Author:** ![lily.wisecarver](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lily.wisecarver/32/20402_2.png) [@lily.wisecarver](https://community.auth0.com/u/lily.wisecarver)\
**Post date:** [March 9, 2020, 7:44pm UTC](https://community.auth0.com/t/username-is-not-populating-in-auth0-drupal-module/37913/3 "2020-03-09T19:44:51Z")

</div>

Hi and Welcome to Auth0 Community! @moneesh.koundal🎉

- `username` is **not** a standard OIDC claim so for a flow that is conformant to OIDC the `username` attribute won’t be automatically included neither in an ID token nor in the `/userinfo` response ([https://openid.net/specs/openid-connect-core-1\_0.html#ScopeClaims](https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims)).
- in the scenario you described you likely are performing an OIDC authentication request and an OAuth 2.0 authorization request for your custom API ( `audience` parameter) at the same time. In other words, you likely received an **ID token** and an **access token**.

However, the above now requires an additional network request at the API level so you may want to review if explicitly including the required information in the access token as custom claims presents a better solution to your scenario. You can include **namespaced** custom claims in issued access tokens through the use of rules ([https://auth0.com/docs/scopes/current/sample-use-cases#add-custom-claims-to-a-token](https://auth0.com/docs/scopes/current/sample-use-cases#add-custom-claims-to-a-token)).

Given `username` is not a standard claim, if you want to include that information in an ID token you will require a custom claim or map that to a standard claim.

---

<div class="post-metadata">

**Author:** ![mathiasconradt](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/mathiasconradt/32/12758_2.png) [@mathiasconradt](https://community.auth0.com/u/mathiasconradt)\
**Post date:** [March 9, 2020, 8:05pm UTC](https://community.auth0.com/t/username-is-not-populating-in-auth0-drupal-module/37913/4 "2020-03-09T20:05:40Z")

</div>

FYI - that same (or similar Drupal related) question came up just two days ago, though slightly different approach:

> [@Username displayed in Drupal admin not correct](http://community.auth0.com/t/username-displayed-in-drupal-admin-not-correct/38599):
>
> Hello, For some reasons, the username entered when signing up is not the one displayed in Drupal admin (/admin/people) “Username” column. Instead, it its displaying the beginning of the user’s email address. This is a little confusing. Any idea how to get the proper username (entered by the user when signing up) there? Thanks!

A code snippet for the custom claim approach is here:

> [@How to Retrieve Username with Auth0-spa-js](http://community.auth0.com/t/how-to-retrieve-username-with-auth0-spa-js/38940/2):
>
> Hey there James! slight_smile I think this will be most effectively handled by reaching out directly to repo maintainers or through GitHub issue.
