Session Management
Understanding Claims in Session JWT Token
Learn how to decode and understand the claims in a session JWT token generated by OTPless.
What Are JWT Claims?
JWT (JSON Web Token) claims are pieces of information encoded into a JWT, providing details about the user and the session. These claims are used to identify users, authorize actions, and validate sessions.
A typical OTPless JWT token consists of three parts:
- Header: Metadata about the token (e.g., signing algorithm).
- Payload: The claims.
- Signature: Ensures the token has not been tampered with.
Decoding an Example JWT
Here’s an example OTPless session JWT:
Encoded JWT
Decoded Payload
Key Claims Explained
sub
(Subject): Identifies the subject of the token, typically the session ID.iss
(Issuer): The entity that issued the token. For OTPless, this is alwayshttps://otpless.com
.name
: The user’s full name.sessionId
: The unique identifier for the user session.exp
(Expiration Time): The Unix timestamp after which the token is no longer valid.iat
(Issued At): The Unix timestamp indicating when the token was issued.userId
: A unique identifier for the user in the OTPless system.email
: The user’s email address.phone
: The user’s phone.
How to Validate Claims
To validate a JWT token:
- Check the
iss
Claim: Ensure the token was issued by OTPless (https://otpless.com
). - Verify the Signature: Use the public key associated with
kid
in the header to ensure the token is not tampered with. You can find the public keys at: https://otpless.com/.well-known/jwks. - Check Expiry (
exp
): Ensure the token has not expired. - Confirm Audience (
aud
): Match theaud
with the OTPless App Id.
Was this page helpful?