- Newest
- Most votes
- Most comments
Amazon Cognito doesn't provide the standard OIDC sid claim in its access or ID tokens by default.
If your goal is to identify the individual JWT, you can use the jti claim. However, jti identifies a token, not the whole login session.
For tracking a login session, origin_jti is usually more useful. When token revocation is enabled, Cognito adds both jti and origin_jti to access and ID tokens. Tokens issued from the same refresh-token session are associated through the original token identifier, and revoking that refresh token invalidates the tokens generated from that session without affecting the user's other refresh-token sessions.
So, roughly:
sub→ identifies the userjti→ identifies an individual JWTorigin_jti→ useful for identifying/tracking the refresh-token sessionauth_time→ tells you when the user authenticated
If you specifically require an application-defined sid, another option is to generate your own session identifier and add it as a custom claim using a Pre Token Generation Lambda trigger. Cognito supports adding custom claims to access and ID tokens through this trigger.
For most Cognito applications, I would use origin_jti together with sub rather than expecting an OIDC sid claim.
Relevant content
asked 3 years ago
asked 5 years ago
- AWS OFFICIALUpdated 4 years ago
- AWS OFFICIALUpdated a year ago
