# Auth0 SID permanent?

**URL:** <https://community.auth0.com/t/auth0-sid-permanent/128013>\
**Category:** Get Help\
**Tags:** account-linking, user-management\
**Created:** [February 21, 2024, 10:14pm UTC](https://community.auth0.com/t/auth0-sid-permanent/128013 "2024-02-21T22:14:21Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![SavDevv](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/savdevv/32/53761_2.png) [@SavDevv](https://community.auth0.com/u/SavDevv)\
**Post date:** [February 21, 2024, 10:14pm UTC](https://community.auth0.com/t/auth0-sid-permanent/128013/1 "2024-02-21T22:14:21Z")

</div>

Hey there,  
I saw that auth0 uses a SID I am just wondering if this is a permanent tag that will not update every few days / every time they log out and back in. If that is not the case are there any alternates?

---

<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:** [February 21, 2024, 10:37pm UTC](https://community.auth0.com/t/auth0-sid-permanent/128013/2 "2024-02-21T22:37:36Z")

</div>

Hey @SavDevv !

The `sid` claim (session ID) is tied to the current authentication and will be updated when a new session is established.

---

<div class="post-metadata">

**Author:** ![SavDevv](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/savdevv/32/53761_2.png) [@SavDevv](https://community.auth0.com/u/SavDevv)\
**Post date:** [February 21, 2024, 10:41pm UTC](https://community.auth0.com/t/auth0-sid-permanent/128013/4 "2024-02-21T22:41:01Z")

</div>

Hey! thanks for the reply. Is there a permanent way of me gathering that like a user ID or something of the sort?

---

<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:** [February 21, 2024, 10:45pm UTC](https://community.auth0.com/t/auth0-sid-permanent/128013/5 "2024-02-21T22:45:12Z")

</div>

No problem, happy to help!

> [@SavDevv](#):
>
> Is there a permanent way of me gathering that like a user ID or something of the sort?

Yes! The `sub` claim sounds like what you are looking for 🙂

> **[JSON Web Token Claims](https://auth0.com/docs/secure/tokens/json-web-tokens/json-web-token-claims#registered-claims)**
>
> Describe JSON web token (JWT) claims and how they are used in Auth0.

---

<div class="post-metadata">

**Author:** ![SavDevv](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/savdevv/32/53761_2.png) [@SavDevv](https://community.auth0.com/u/SavDevv)\
**Post date:** [February 21, 2024, 10:46pm UTC](https://community.auth0.com/t/auth0-sid-permanent/128013/6 "2024-02-21T22:46:07Z")

</div>

Perfect ill give it a shot now!  
Thanks again for the help 😃

---

<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:** [February 21, 2024, 10:50pm UTC](https://community.auth0.com/t/auth0-sid-permanent/128013/7 "2024-02-21T22:50:56Z")

</div>

> [@SavDevv](#):
>
> Is there a permanent way of me gathering that like a user ID or something of the sort?

Re-reading this again - Just to be clear, the `sub` claim is the `user_id` and does not change. This has nothing to do with the authentication session. The `sid` claim provides that, but of course will change when the session changes.

---

<div class="post-metadata">

**Author:** ![SavDevv](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/savdevv/32/53761_2.png) [@SavDevv](https://community.auth0.com/u/SavDevv)\
**Post date:** [February 21, 2024, 10:53pm UTC](https://community.auth0.com/t/auth0-sid-permanent/128013/8 "2024-02-21T22:53:35Z")

</div>

Alright, So to get the user\_id id need to grab it off the SID if that’s correct? - I should add im using node.js for this

---

<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:** [February 21, 2024, 10:56pm UTC](https://community.auth0.com/t/auth0-sid-permanent/128013/9 "2024-02-21T22:56:58Z")

</div>

No, the `sub` claim is equivalent to `user_id` - Sorry for the confusion!

---

<div class="post-metadata">

**Author:** ![SavDevv](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/savdevv/32/53761_2.png) [@SavDevv](https://community.auth0.com/u/SavDevv)\
**Post date:** [February 21, 2024, 11:03pm UTC](https://community.auth0.com/t/auth0-sid-permanent/128013/10 "2024-02-21T23:03:59Z")

</div>

Sorry for being a pain, When im on application cookies all it shows is appSession when i have attempted to decode it in [https://jwt.io/](https://jwt.io/) i am met with a error saying that its not a valid json object. What am i doing wrong here?

---

<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:** [February 21, 2024, 11:32pm UTC](https://community.auth0.com/t/auth0-sid-permanent/128013/11 "2024-02-21T23:32:47Z")

</div>

[jwt.io](http://jwt.io) will help you decode JWT (json web tokens) access and/or ID tokens, not cookies. The `sub` claim is a standard claim included in a user’s token(s) upon authentication.

---

<div class="post-metadata">

**Author:** ![SavDevv](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/savdevv/32/53761_2.png) [@SavDevv](https://community.auth0.com/u/SavDevv)\
**Post date:** [February 21, 2024, 11:57pm UTC](https://community.auth0.com/t/auth0-sid-permanent/128013/12 "2024-02-21T23:57:17Z")

</div>

Oh right, So i just add on the claim say like

```auto
      const userProfile = req.oidc.user;
      given_name: userProfile.given_name,
      family_name: userProfile.family_name,
      email: userProfile.email,
      user_id: userProfile.sub

```

---

<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:** [March 6, 2024, 11:57pm UTC](https://community.auth0.com/t/auth0-sid-permanent/128013/13 "2024-03-06T23:57:18Z")

</div>

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