Auth0 SID permanent?

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?

1 Like

Hey @SavDevv !

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

2 Likes

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

1 Like

No problem, happy to help!

Yes! The sub claim sounds like what you are looking for :slight_smile:

1 Like

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

1 Like

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.

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

1 Like

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

1 Like

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/ i am met with a error saying that its not a valid json object. What am i doing wrong here?

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.

1 Like

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

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

1 Like

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