- Intro to IAM
- What Is Single Sign-On (SSO)?
What Is Single Sign-On (SSO)?
Single Sign-On (SSO) allows users to authenticate once with a centralized Identity Provider (IdP) and access multiple applications without re-entering credentials. SSO eliminates password fatigue by shifting authentication responsibility from individual applications to a central authority that maintains the authenticated state.
When you authenticate with your corporate network and immediately access Slack, GitHub, or an internal knowledge base without re-entering passwords for each application, you’re experiencing SSO work exactly as designed.
Why SSO Matters for Developers
SSO implementation provides immediate and measurable benefits for both security and development teams by centralizing control and standardizing the authentication experience.
Centralizing Security and Compliance
- Minimizes Attack Surface: Centralizing authentication to a single primary authentication event reduces the number of credentials users actively manage across the ecosystem, helping to minimize the overall attack surface and potential for compromise.
- Enforces Consistent Policies: SSO helps enforce strong authentication policies, including Multi-Factor Authentication (MFA), at the IdP. This eliminates the need to implement redundant measures across dozens of systems.
- Simplifies Auditability: Centralized authentication logs streamline the creation of audit trails and compliance reporting, providing security teams with a single source of truth for user access across the entire application ecosystem.
Improving Velocity and User Experience (UX)
- Eliminates Redundancy: For development teams, SSO removes the requirement to implement and maintain authentication logic in every new application, allowing developers to focus on core features.
- Reduces Support Overhead: Adopting SSO minimizes the volume of help desk tickets for password resets and account lockouts, allowing support teams to focus on higher-value issues.
- Accelerates Provisioning: User onboarding and de-provisioning are simplified, as access to multiple systems is granted or revoked through a single action within the central identity system.
How SSO Works: The Protocol Exchange
SSO operates through a series of secure, session-based redirects built on a cryptographic trust relationship between an application (the Service Provider, or SP) and the IdP.
The Core SSO Flow
- Initial Request: A user attempts to access a protected application (SP). The SP, recognizing the unauthenticated request, redirects the user’s browser to the IdP’s login endpoint.
- Authentication and IdP Session: The user authenticates with the IdP using a preferred method (like a password, passkey, or biometric). The IdP validates the identity, establishes an authenticated session, and stores a secure session identifier (typically in an
HttpOnly,Secure,SameSitecookie). - Token Issuance: The IdP redirects the user back to the SP with a security artifact tailored for that application.
- For Security Assertion Markup Language (SAML) 2.0, specified by OASIS, this artifact is a signed XML assertion containing user identity claims.
- For OpenID Connect (OIDC), as specified by the OpenID Foundation, this involves exchanging an authorization code for an ID token and an access token, along with an optional refresh token, depending on the client type and scope configuration. For more on this distinction, see Authentication vs. Authorization.
- Access Granted: The SP validates the assertion or token by checking its signature, expiration (
exp), not-before (nbf), issuer (iss), and audience (aud) claims and establishes a local session for the user.
Seamless Subsequent Access
When the same user, within the same browser session, accesses a second application that trusts the same IdP:
- The second application detects the unauthenticated request and redirects the user to the IdP.
- The IdP immediately detects the existing authenticated session via its session cookie.
- The IdP issues a new, application-specific security token without prompting the user to re-authenticate.
- The user gains seamless access to the second application.
This reuse of the central authentication event is the technical foundation for SSO.
Choosing an SSO Protocol: OIDC vs. SAML
Modern SSO relies on standardized protocols that govern the exchange of identity and authorization data. Selecting the correct protocol (or often, supporting both) is necessary for integration flexibility.
| Protocol | Token Format | Primary Use Case | Complexity |
|---|---|---|---|
| SAML 2.0 | XML assertions | Enterprise B2B Federation, Legacy Systems | More verbose; requires X.509 certificate management for signature verification and optional encryption, including certificate rotation and expiration monitoring |
| OIDC | JSON Web Tokens (JWTs) | Modern Web, Mobile, and API-Driven Applications | Simpler, RESTful, and more developer-friendly |
- OIDC is the identity layer built on OAuth 2.0. It uses signed JWTs for identity claims in ID tokens and aligns natively with API architectures. For new, internet-facing, or mobile applications, OIDC with the Authorization Code Flow and PKCE is the OAuth 2.0 Security Best Current Practice recommendation.
- SAML 2.0 remains prevalent for B2B federation, especially when integrating with customer identity infrastructure, such as Active Directory Federation Services (AD FS), as it is often a mandatory requirement for large enterprises.
In a B2B SaaS context, the application must often support both protocols, as a customer’s IdP dictates the integration requirement.
SSO for Multi-Tenant SaaS Applications
In B2B SaaS, multi-tenant SSO requires an application (the SP) to federate with each customer organization’s independent IdP.
- Tenant-Specific Configuration: An application must securely store and manage unique IdP configuration metadata (such as SAML signing certificates or OIDC client secrets) for each customer.
- Home Realm Discovery (HRD): The application must determine which customer’s IdP to use for routing the authentication request. This is commonly achieved by routing the application based on the user’s email domain or an organization identifier entered before login.
- Just-In-Time (JIT) Provisioning: JIT automatically creates the user’s local account in the application during the initial SSO authentication flow, based on claims received from the IdP. This eliminates the manual provisioning of user accounts for enterprise users.
- Post-Authentication Authorization: After successful SSO authentication, an application must enforce authorization policies, such as Role-Based Access Control (RBAC), to determine which resources the user can access. SSO confirms identity, and the application’s authorization layer controls permissions
Security Hardening and Token Management
While SSO centralizes authentication, it consolidates risk. Developers must ensure the SP is hardened against token-related vulnerabilities.
- Non-Negotiable Token Validation: Every protected API endpoint must perform full JWT validation. This includes verifying the signature integrity, checking the
expclaim, and confirming theissandaudclaims to ensure the token is authentic and intended for your application. - Secure Storage: Avoid storing sensitive access tokens or refresh tokens in
localStorageorsessionStorage, as this poses an elevated risk of Cross-Site Scripting (XSS). For single-page applications, use in-memory storage with automatic refresh. For traditional web apps, useHttpOnly,Securecookies withSamSiteflags. - PKCE for OIDC: Always use the Authorization Code Flow with Proof Key for Code Exchange (PKCE) for all OIDC-based applications, including mobile and web, to mitigate authorization code interception attacks.
- Short-Lived Tokens: Use short-lived access tokens (with a maximum duration of 15–60 minutes) and implement refresh token rotation. Each refresh operation issues a new refresh token and invalidates the previous one, allowing for the immediate detection of token theft.
- Session Fixation Prevention: After validating the IdP token, the Service Provider must regenerate its local session identifier immediately to prevent session fixation attacks. This is the responsibility of the SP (not the IdP).
Common SSO Implementation Mistakes
Insecure SP Session Handling
Service Providers often validate the IdP token correctly, but fail to secure their own application session. After SSO authentication, the SP must establish a secure session with proper timeout, CSRF protection, and secure cookie flags.
Inadequate Token Lifetime Policies
Accepting long-lived IdP sessions (24+ hours) without re-authentication creates risk. Implement appropriate session timeouts and prompt for re-authentication before high-risk actions using step-up authentication.
Ignoring Logout Complexity
SSO logout requires coordination between the IdP and all active SPs. Incomplete implementations leave sessions active in some applications after “logout,” creating a false sense of security. Implement either centralized logout (Single Logout/SLO) or clear communication about session behavior.
Trusting IdP Assertions Without Validation
Service Providers must validate every token signature, expiration, audience, and issuer claim. Skipping validation because “it came from our IdP” is a vulnerability that attackers can exploit through token forgery or replay attacks.
SSO Implementation FAQs
How does SSO work with mobile applications?
Mobile SSO uses the OIDC protocol with the Authorization Code Flow and PKCE. It requires the system browser (ASWebAuthenticationSession on iOS, Custom Tabs on Android) rather than embedded webviews. The system browser shares the IdP’s session cookie across apps using the same authentication domain, enabling true SSO. However, session sharing behavior varies by platform and privacy settings. iOS ASWebAuthenticationSession creates ephemeral sessions by default, requiring users to opt in to session persistence. Embedded webviews can not access the system cookie store and break the SSO experience.
Is SSO a substitute for Multi-Factor Authentication (MFA)?
No. SSO determines where authentication happens (at a central IdP). MFA determines the strength of the authentication. Organizations should combine both: enforce MFA at the central IdP so that a single strong authentication protects access to all connected applications.
When is SSO not the right choice?
SSO’s complexity and infrastructure requirements often outweigh the benefits for small, consumer-facing applications or simple content sites. SSO provides maximum value in enterprise environments with centralized IT management, where users need consistentZ access to multiple secured resources.
Advance Your Identity Strategy
Implementing SSO from scratch, especially supporting both SAML and OIDC, is a complex effort. Using a dedicated identity platform like Auth0 can help handle the protocol complexity, session management, and security hardening, enabling developers to focus on core application features.
Explore our Intro to IAM series for additional topics related to identity and access management.
Table of contents
- Why SSO Matters for Developers
- How SSO Works: The Protocol Exchange
- Choosing an SSO Protocol: OIDC vs. SAML
- SSO for Multi-Tenant SaaS Applications
- Security Hardening and Token Management
- Common SSO Implementation Mistakes
- SSO Implementation FAQs
- Advance Your Identity Strategy
Download the guide to Single-Sign on (SSO)
Get the guide to SSO to see how Auth0 can help you.
Download the guideQuick assessment
SSO is a method for:
Quick assessment
SSO?