# Maping custom data to user authenticated by okta

**URL:** <https://devforum.okta.com/t/maping-custom-data-to-user-authenticated-by-okta/9731>\
**Category:** Questions\
**Created:** [June 11, 2020, 1:59pm UTC](https://devforum.okta.com/t/maping-custom-data-to-user-authenticated-by-okta/9731 "2020-06-11T13:59:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkpkpk](https://avatars.discourse-cdn.com/v4/letter/p/5f9b8f/32.png) [@pkpkpk](https://devforum.okta.com/u/pkpkpk)\
**Post date:** [June 11, 2020, 1:59pm UTC](https://devforum.okta.com/t/maping-custom-data-to-user-authenticated-by-okta/9731/1 "2020-06-11T13:59:26Z")

</div>

Let’s say I want to build ToDo app with Okta authentication.

I need to store users’ tasks in the relational database.

The user has to have the ability to query only his tasks.

What user property should I use as a user identifier in my database?

In access token, I can see claims like uid and sub which seems to be suitable for my needs.

Unfortunately, both of them are strings instead of numeric values.

Using them as tables’ primary key seems like a very inefficient idea.

Could you recommend a better way of achieving my goal?

---

<div class="post-metadata">

**Author:** ![mraible](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/mraible/32/37_2.png) [@mraible](https://devforum.okta.com/u/mraible)\
**Post date:** [June 11, 2020, 9:48pm UTC](https://devforum.okta.com/t/maping-custom-data-to-user-authenticated-by-okta/9731/2 "2020-06-11T21:48:31Z")

</div>

Sub is usually the best value to use. It’s a unique identifier.

---

<div class="post-metadata">

**Author:** ![pkpkpk](https://avatars.discourse-cdn.com/v4/letter/p/5f9b8f/32.png) [@pkpkpk](https://devforum.okta.com/u/pkpkpk)\
**Post date:** [June 12, 2020, 7:46am UTC](https://devforum.okta.com/t/maping-custom-data-to-user-authenticated-by-okta/9731/3 "2020-06-12T07:46:03Z")

</div>

The ‘sub’ claim is the user’s email. I is immutable?

---

<div class="post-metadata">

**Author:** ![dragos](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/dragos/32/1313_2.png) [@dragos](https://devforum.okta.com/u/dragos)\
**Post date:** [June 17, 2020, 12:53am UTC](https://devforum.okta.com/t/maping-custom-data-to-user-authenticated-by-okta/9731/4 "2020-06-17T00:53:24Z")

</div>

Hi @pkpkpk

The `sub` claim inside the ID token represents the user’s Okta ID and it’s immutable.  
For the acces token, the `sub` claim represents the “Username” field that is populated for the user under Admin \>\> Applications \>\> _application_ \>\> Assignments \>\> _user_ \>\> pencil icon.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [January 24, 2024, 8:05pm UTC](https://devforum.okta.com/t/maping-custom-data-to-user-authenticated-by-okta/9731/5 "2024-01-24T20:05:19Z")

</div>

Closed on January 24, 2024, 8:05pm UTC

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