# Get User logged

**URL:** <https://community.auth0.com/t/get-user-logged/121989>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [November 29, 2023, 11:34pm UTC](https://community.auth0.com/t/get-user-logged/121989 "2023-11-29T23:34:32Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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:** [November 30, 2023, 1:29am UTC](https://community.auth0.com/t/get-user-logged/121989/3 "2023-11-30T01:29:16Z")

</div>

Hey there @Gerarca !

> [@Gerarca](#):
>
> Let me explain to you, When a user is successfully logged in, is it possible to obtain the user’s email? and then save it in my database??

The easiest route is probably to add the user’s email as a custom claim in the access token which can be accessed by your backend:

> [@Alternative to using rule to attach email to access tokens](https://community.auth0.com/t/alternative-to-using-rule-to-attach-email-to-access-tokens/121853/3):
>
> Hello @jmdot welcome to the community! Similar to a rule, you will just need to add email as a custom claim using an Action - A [Post Login Action](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow) should work for this and look like the following: exports.onExecutePostLogin = async (event, api) =\> { const namespace = 'https://myapp.example.com/'; const email = event.user.email; if (email) { api.accessToken.setCustomClaim(`${namespace}email`, email); } }; Since email is not a [restricted claim](https://auth0.com/docs/secure/tokens/json-web-tokens/create-custom-claims#non-restricted-claims) you can also forego using a namespace…

Alternatively, you can always user the [userinfo endpoint](https://auth0.com/docs/api/authentication#get-user-info).

---

_[View the full topic](https://community.auth0.com/t/get-user-logged/121989)._
