session_token and session_jwt that you can use to authorize requests.
Sessions have a configurable lifetime (default: 60 minutes) and can be extended by re-authenticating them before they expire. Sessions contain authentication factors and can be revoked at any time.
Common operations
- Authenticate Session
- Revoke Session
- Get Sessions
- Exchange Intermediate Session
Validate a session and optionally extend its lifetime. Use this to authorize requests in your application.Parameters:
1
Authenticate with session token
session_token: The session token to validate (use either this orsession_jwt)session_jwt: Alternative tosession_token- the JWT to validatesession_duration_minutes: (Optional) Extend session lifetime by this many minutessession_custom_claims: (Optional) Custom claims to add to the session JWTauthorization_check: (Optional) Check RBAC permissions during authentication
2
Use for request authorization
Store the
session_token or session_jwt and include it in subsequent requests to verify the user is authenticated. Call the authenticate endpoint on each request or periodically to validate the session is still active.You can pass an expired JWT (based on its
exp claim) and receive a new JWT if the underlying Session is still valid.Session tokens vs JWTs
Stytch provides two token formats for sessions:Session Tokens
Opaque tokens that must be validated server-side via the authenticate endpoint.
- More secure (can’t be decoded)
- Requires API call to validate
- Can be revoked immediately
Session JWTs
JSON Web Tokens that can be validated locally using your project’s public key.
- Can validate without API calls
- Contains claims (member ID, org ID, etc.)
- Slightly delayed revocation (until JWT expires)
Authentication factors
Sessions track which authentication methods were used. Common factors include:- Magic Links - Email-based authentication
- OAuth - Social login (Google, Microsoft, etc.)
- OTP - One-time passcodes via email or SMS
- SSO - SAML or OIDC connections
- Passwords - Traditional password authentication
- TOTP - Authenticator app codes
- WebAuthn - Biometric or security key authentication
RBAC authorization checks
You can combine session authentication with RBAC permission checks:Next steps
Session management guide
Comprehensive session documentation
RBAC
Implement role-based access control with sessions