# Getting your identifier id

**URL:** <https://devforum.okta.com/t/getting-your-identifier-id/13688>\
**Category:** Questions\
**Created:** [April 7, 2021, 4:38pm UTC](https://devforum.okta.com/t/getting-your-identifier-id/13688 "2021-04-07T16:38:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![owen](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@owen](https://devforum.okta.com/u/owen)\
**Post date:** [April 7, 2021, 4:38pm UTC](https://devforum.okta.com/t/getting-your-identifier-id/13688/1 "2021-04-07T16:38:00Z")

</div>

In my SPA, I want to get the okta user-id when I call this function:

`const user = await this.$auth.getUser()`

but at the moment, it returns the sub-attribute which has the app client id for my SPA

I did some research and found the expression `user.getInternalProperty("id")`, but it is also returning the app client id.

My current setting:  
scopes: [‘openid’, ‘profile’, ‘email’],  
pkce: true,  
response\_type: ‘id\_token’

What is the right way to getting the user id?

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [April 7, 2021, 7:07pm UTC](https://devforum.okta.com/t/getting-your-identifier-id/13688/2 "2021-04-07T19:07:51Z")

</div>

hmm… that’s odd.

The [getUser](https://github.com/okta/okta-auth-js#tokengetuserinfoaccesstokenobject-idtokenobject) method should be making a call to the userinfo endpoint and, provided the token you are sending to the endpoint was issued to an end-user, [the ‘sub’ value returned](https://developer.okta.com/docs/reference/api/oidc/#base-claims-always-present) should be the user’s ID in your Okta org, see the example in our docs [here](https://developer.okta.com/docs/reference/api/oidc/#response-example-success-5).

If you log into your application, grab the raw JWT ID token (you can find it stored in Local/Session/Cookie Storage, depending on which you chose but local should be the default, with the key `okta-token-storage`), and [decode the token](https://token.dev/), do you see the user’s ID as the `sub` claim value?

---

<div class="post-metadata">

**Author:** ![owen](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@owen](https://devforum.okta.com/u/owen)\
**Post date:** [April 7, 2021, 7:55pm UTC](https://devforum.okta.com/t/getting-your-identifier-id/13688/3 "2021-04-07T19:55:05Z")

</div>

Yes, I see it now. My fault, the client id, and the user id were very similar, except for 3 characters. After, decoding it, I was able to compare the values.

Thanks.

---

<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:** [April 8, 2021, 7:55pm UTC](https://devforum.okta.com/t/getting-your-identifier-id/13688/4 "2021-04-08T19:55:06Z")

</div>

Closed on April 8, 2021, 7:55pm UTC

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