Single sign-on lets a person authenticate once with an identity provider and then reach many applications without signing in again. Two open protocols do most of that work today: SAML 2.0 and OpenID Connect (OIDC). Both solve the same basic problem, yet they come from different eras of the web, carry identity in different formats, and suit different kinds of applications.
If you are adding SSO to a product, or connecting an internal system to a corporate identity provider, the choice affects your libraries, your test plan and how much effort each new customer connection takes. This guide explains how each protocol works and offers a simple way to decide.
How SAML 2.0 works
SAML is an XML-based framework for exchanging security information between parties, maintained by the OASIS Security Services Technical Committee. The core SAML 2.0 documents date from March 2005, and the protocol remains common in enterprise software.
The model has two main roles:
- Identity provider (IdP): authenticates the user and issues statements about them.
- Service provider (SP): your application, which consumes those statements and grants access.
Those statements travel inside an assertion, an XML document that can carry authentication, attribute and authorization-decision statements about a subject. The assertion is usually digitally signed so the SP can trust it.
SAML defines bindings, which describe how messages move over lower-level protocols. For browser SSO, the ones you meet most often are HTTP Redirect, HTTP POST and HTTP Artifact. The Web Browser SSO profile ties these together and supports two starting points:
- SP-initiated: the user visits your application first, is redirected to the IdP to sign in, and returns with an assertion.
- IdP-initiated: the user is already signed in at the IdP and follows a link to your application; the IdP sends an assertion without a prior request from you.
Partners exchange metadata, an XML document listing endpoints, supported bindings and signing or encryption keys. SAML also defines Single Logout, which aims to end a user’s sessions across participating providers at about the same time.
How OpenID Connect works
The OIDC Core specification describes OpenID Connect as an identity layer on top of OAuth 2.0. OAuth 2.0 on its own is about delegated authorization; it does not say how the end user was authenticated. OIDC adds that piece. A client requests the openid scope, and the provider returns an ID Token alongside any access token.
The ID Token is a JSON Web Token (JWT). It must be signed using JWS and can optionally be encrypted with JWE. Every ID Token carries a set of required claims, including:
| Claim | Meaning |
|---|---|
iss |
The issuer identifier, an HTTPS URL |
sub |
A stable identifier for the user at that issuer, never reassigned |
aud |
The audience, which must include your client ID |
exp |
The expiry time after which the token must be rejected |
iat |
The time the token was issued |
OIDC Core defines three flows, selected by the response_type parameter: the Authorization Code Flow, where tokens come from the token endpoint after a code exchange; the Implicit Flow, where tokens come straight from the authorization endpoint; and the Hybrid Flow, which mixes the two. It also defines a UserInfo endpoint that returns claims about the user when called with an access token.
The practical differences
| Topic | SAML 2.0 | OpenID Connect |
|---|---|---|
| Data format | XML assertions | JSON Web Tokens |
| Built on | Its own protocol and bindings | OAuth 2.0 |
| Typical client | Server-rendered web applications | Web, single-page, mobile and API clients |
| API access | Focused on browser sign-in | Access tokens from the same OAuth flow |
| Configuration | Metadata files exchanged between partners | Client registration with the provider |
The format difference matters more than it first appears. XML signature handling is subtle, and SAML libraries need careful configuration. JWT handling has its own pitfalls, but the tooling in most modern stacks is lighter and the tokens are easy to inspect while debugging.
The other big difference is scope. SAML answers “who is this user?” for a browser session. OIDC answers the same question and, because it sits on OAuth 2.0, can also give your application an access token to call APIs on the user’s behalf.
How to choose
Start from the application and the people connecting to it, not from the protocol.
Choose OIDC when:
- You are building a new application, especially a single-page app, a mobile app or anything that calls your own APIs.
- You need both sign-in and API authorization from the same identity provider.
- Your team prefers JSON and standard OAuth libraries.
Choose SAML when:
- Your customers’ identity teams expect it, which is common in enterprise B2B software.
- You are integrating with an older system or identity provider that only speaks SAML.
- The application is a traditional server-rendered web app with no API delegation needs.
Support both when you sell software to many organizations. Each customer brings its own identity provider and its own preferences. A clean internal abstraction, where your application consumes a normalized “authenticated user” object regardless of protocol, keeps the extra protocol from leaking into business code.
An implementation checklist
Whichever protocol you choose, the same disciplines apply:
- Use a maintained library. Do not hand-roll XML signature validation or JWT parsing.
- Validate everything the spec requires. For OIDC, that includes the issuer, audience, signature and expiry of every ID Token. For SAML, follow your library’s guidance on signature, audience and validity checks, and never accept unsigned assertions.
- Pin trust to configuration, not to the message. Load signing keys from metadata or the provider’s published keys, not from whatever the incoming message claims.
- Map identities on a stable identifier. In OIDC, the
issandsubpair identifies a user. Email addresses can change and should not be your primary key. - Decide on IdP-initiated SAML deliberately. It is convenient for users but gives you less context about the request, so enable it only where a customer needs it.
- Plan provisioning separately. SSO signs users in; it does not create, update or remove accounts. Decide how accounts are provisioned and deprovisioned.
- Test failure paths. Expired tokens, clock skew, rotated signing keys and a user removed at the IdP should all produce clear, safe outcomes.
- Log authentication events. Record which provider, which user and which outcome, without logging tokens or assertions in full.
Common mistakes
A few problems come up repeatedly in SSO projects:
- Treating an OAuth access token as proof of identity. Use the ID Token for sign-in; access tokens are meant for APIs.
- Skipping audience checks, which lets a token issued for one application be replayed against another.
- Hard-coding one customer’s settings into code instead of per-tenant configuration.
- Ignoring logout. Users expect signing out to work, and security teams expect sessions to end when an account is disabled.
How Devacon can help
We design and build SSO for new and existing applications, using SAML, OpenID Connect or both, and connect them to identity providers such as Microsoft Entra ID and Okta. A typical engagement covers protocol selection, integration, provisioning and test coverage for the failure paths. Learn more about our identity and access management services.
Sources
Facts in this article were checked against the sources above on November 17, 2026. Standards and products change, so check the source before relying on a detail. Related service: Identity & Access Management.