Overview
Last updated
Last updated
This section explains how Single Sign-On works behind the scenes. Understanding this flow helps both developers implement SSO correctly and end users understand what's happening during login.
After reading this section, you'll understand:
The complete SSO authentication flow
What happens at each step
The role of different components
How tokens work in SSO
Security considerations
Where the user interacts with applications
Handles redirects between application and IDP
Stores session cookies (temporarily)
Next: Dive deeper into the Flow Diagram to see the technical details
Frontend: User interface, login buttons
Backend: Handles OAuth flow, stores tokens securely
Identity Provider: Authenticates users
Token Service: Issues and validates tokens
User Store: Manages user accounts and profiles
Purpose: Temporary code to exchange for tokens
Lifetime: Very short (usually 10 minutes)
Security: Single-use only
Example: abc123def456ghi789
Purpose: Grants access to protected resources
Lifetime: Short (15-60 minutes)
Format: Usually JWT (JSON Web Token)
Usage: Sent with API requests
Purpose: Obtains new access tokens
Lifetime: Long (days to months)
Security: Stored securely, can be revoked
Usage: Automatic token renewal
Purpose: Contains user identity information
Format: JWT with user claims
Contents: User ID, email, name, etc.
Usage: Application knows who the user is
Purpose: Prevents CSRF attacks
How it works: Random value sent and verified
Implementation: Generated by app, validated on return
Purpose: Secures public clients (SPAs, mobile)
How it works: Code challenge/verifier pair
Required for: Applications that can't store secrets
Purpose: Prevents replay attacks
How it works: Random value in ID token
Usage: OpenID Connect flows
Login: User authenticates, session created
Active: User accesses applications
Refresh: Tokens renewed automatically
Timeout: Session expires due to inactivity
Logout: User explicitly logs out
Access tokens: 15-60 minutes
Refresh tokens: 7-30 days
ID tokens: Same as access tokens
SSO session: 8-24 hours (configurable)
Single logout: Logging out of one app logs out of all
Session sharing: Login to one app grants access to others
Centralized control: IT can revoke access globally
Login success/failure rates
Token refresh patterns
Session duration statistics
Error rates by type
Performance metrics
Log authentication events
Don't log sensitive data (passwords, tokens)
Include correlation IDs
Monitor for suspicious patterns
Invalid credentials: User enters wrong password
Expired code: Authorization code takes too long to exchange
Invalid client: Application not properly registered
Access denied: User cancels authentication
Server errors: IDP temporarily unavailable
User-friendly messages: Don't expose technical details
Retry mechanisms: Handle temporary failures gracefully
Fallback options: Provide alternative authentication methods
Monitoring: Alert on error rate spikes