# ID Token for Open ID Connect

**URL:** <https://community.auth0.com/t/id-token-for-open-id-connect/125130>\
**Category:** Get Help\
**Tags:** new-universal-login-experience, login-experience\
**Created:** [January 18, 2024, 10:57pm UTC](https://community.auth0.com/t/id-token-for-open-id-connect/125130 "2024-01-18T22:57:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kush1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kush1/32/73206_2.png) [@Kush1](https://community.auth0.com/u/Kush1)\
**Post date:** [January 18, 2024, 10:57pm UTC](https://community.auth0.com/t/id-token-for-open-id-connect/125130/1 "2024-01-18T22:57:34Z")

</div>

Hi,

Is there a way to add given\_name and family\_name into the ID Token? A sample action maybe?

My third party platform requires these to auto generate users on authentication if they don’t exist, and they are missing in the ID Token. We only have name.

---

<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:** [January 19, 2024, 12:34am UTC](https://community.auth0.com/t/id-token-for-open-id-connect/125130/3 "2024-01-19T00:34:28Z")

</div>

Hey @Kush1 !

> [@Kush1](#):
>
> Is there a way to add given\_name and family\_name into the ID Token? A sample action maybe?

Do user’s have a `given_name` and `family_name` in Auth0? If so, I _believe_ these claims should be included in ID tokens by default if including the `profile` scope when calling the authorize endpoint.

If not, here’s a Post Login Action that should do the trick:

```auto
exports.onExecutePostLogin = async (event, api) => {
  const namespace = 'https://yournamespace.com/'; // Replace with a unique identifier URL
  if (event.user.given_name) {
    api.idToken.setCustomClaim(`${namespace}given_name`, event.user.given_name);
  }
  if (event.user.family_name) {
    api.idToken.setCustomClaim(`${namespace}family_name`, event.user.family_name);
  }
};

```

---

<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:** [February 2, 2024, 12:35am UTC](https://community.auth0.com/t/id-token-for-open-id-connect/125130/4 "2024-02-02T00:35:21Z")

</div>

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