# Access profile username from Flask/Python

**URL:** <https://community.auth0.com/t/access-profile-username-from-flask-python/76059>\
**Category:** Get Help\
**Tags:** jwt, api, login\
**Created:** [January 9, 2022, 6:51pm UTC](https://community.auth0.com/t/access-profile-username-from-flask-python/76059 "2022-01-09T18:51:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zuma206](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/zuma206/32/34290_2.png) [@Zuma206](https://community.auth0.com/u/Zuma206)\
**Post date:** [January 9, 2022, 6:51pm UTC](https://community.auth0.com/t/access-profile-username-from-flask-python/76059/1 "2022-01-09T18:51:50Z")

</div>

Hello,

I’m very new to Auth0 and Oauth, and i’ve just implemented the basic python quick start into my app. In my database I set it to ask for a username. In the JWT I recieve after login there is not key for this username. So, I would like to know how to access this username, is there a scope for it that im missing or do you have to make a seperate API call? I’ve already used the scopes openid, profile, and email but that hasn’t worked.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [January 12, 2022, 2:53am UTC](https://community.auth0.com/t/access-profile-username-from-flask-python/76059/3 "2022-01-12T02:53:45Z")

</div>

Hi @Zuma206,

Welcome to the Auth0 Community!

Unfortunately, the _Username_ attribute is not part of the [list of standard claims](https://auth0.com/docs/get-started/apis/scopes/openid-connect-scopes#standard-claims) returned from the `openid profile email` scopes.

In this scenario, you will need to append the username as a custom claim to the ID token using an [Auth0 Post-Login Action.](https://auth0.com/docs/customize/actions/triggers/post-login#add-user-roles-to-id-and-access-tokens). See below for an example.

```auto
exports.onExecutePostLogin = async (event, api) => {
  const namespace = 'https://my-app.example.com';
  if (event.authorization) {
    api.idToken.setCustomClaim(`${namespace}/username`, event.user.username);
  }
}

```

After you have included this action into the auth pipeline, you will be able to get the username in the ID Token.

Please let me know if there’s anything else I can do to help.

Thanks.

---

<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:** [January 27, 2022, 2:53am UTC](https://community.auth0.com/t/access-profile-username-from-flask-python/76059/4 "2022-01-27T02:53:59Z")

</div>

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