# I can't add the user email on access\_token

**URL:** <https://community.auth0.com/t/i-cant-add-the-user-email-on-access-token/83958>\
**Category:** Get Help\
**Tags:** jwt, rules, login\
**Created:** [May 23, 2022, 8:51pm UTC](https://community.auth0.com/t/i-cant-add-the-user-email-on-access-token/83958 "2022-05-23T20:51:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![joaomarcelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/joaomarcelo/32/36053_2.png) [@joaomarcelo](https://community.auth0.com/u/joaomarcelo)\
**Post date:** [May 23, 2022, 8:51pm UTC](https://community.auth0.com/t/i-cant-add-the-user-email-on-access-token/83958/1 "2022-05-23T20:51:48Z")

</div>

I tried adding user access by following the following topics:  
[tutorial 1](https://community.auth0.com/t/can-i-add-email-address-to-the-access-token-when-calling-an-api/70163)

AND  
[tutorial 2](https://community.auth0.com/t/get-user-info-from-his-access-token/36978)

But when I try to login to some user using this tutorial: [Get access token using the email + password](https://auth0.com/docs/get-started/authentication-and-authorization-flow/call-your-api-using-resource-owner-password-flow)

The access token that I get doesn’t contain the user’s email.

Am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [May 23, 2022, 9:50pm UTC](https://community.auth0.com/t/i-cant-add-the-user-email-on-access-token/83958/3 "2022-05-23T21:50:25Z")

</div>

Hi there @joaomarcelo welcome to the community!

> [@joaomarcelo](#):
>
> The access token that I get doesn’t contain the user’s email.
> 
> Am I doing something wrong?

It’s hard to know exactly what the issue could be, but if you are not getting the email claim back in the Access Token then something is off - Might I suggest that you take a look at using [Actions](https://auth0.com/docs/customize/actions) instead? In particular, you will want to look at utilizing a [Post Login Action](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow), something like this:

```auto
exports.onExecutePostLogin = async (event, api) => {
  // This adds the authenticated user's email address to the access token.
  if (event.authorization) {
    const namespace = 'https://MY_DOMAIN_DOT_COM';
    api.accessToken.setCustomClaim(`${namespace}/claims/email`, event.user.email);
  }
};

```

Let us know if that doesn’t do the trick!

---

<div class="post-metadata">

**Author:** ![joaomarcelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/joaomarcelo/32/36053_2.png) [@joaomarcelo](https://community.auth0.com/u/joaomarcelo)\
**Post date:** [May 24, 2022, 6:00pm UTC](https://community.auth0.com/t/i-cant-add-the-user-email-on-access-token/83958/4 "2022-05-24T18:00:41Z")

</div>

Thanks a lot!  
The Post login action works! 🤘

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [May 24, 2022, 9:40pm UTC](https://community.auth0.com/t/i-cant-add-the-user-email-on-access-token/83958/5 "2022-05-24T21:40:58Z")

</div>

Awesome! Happy to hear that and thanks for confirming 🤘

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [June 8, 2022, 9:41pm UTC](https://community.auth0.com/t/i-cant-add-the-user-email-on-access-token/83958/6 "2022-06-08T21:41:12Z")

</div>

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