Imagine a fintech startup moving from a web-only dashboard to a mobile-first experience. Their enterprise clients already use SAML-based SSO to access internal tools, but now the team needs lightweight, mobile-friendly authentication.
The challenge arises because SAML was designed with a web-first, XML-based approach in mind, relying heavily on SAML assertions that depend on browser redirects. Mobile apps, on the other hand, benefit from lightweight authentication mechanisms with fewer browser dependencies. So, the question becomes: Should they extend their existing SAML stack or use OIDC for a mobile-friendly authentication system with better performance and developer experience?
This guide breaks down that decision, showing where each protocol fits, how they behave in real-world systems, and how to support both when needed.
Authentication in distributed systems, especially those built on platforms like AWS or Azure, is more than login. It affects scalability, compliance, and how easily teams integrate identity across services. Your choice of protocol shapes what your system can support and what it can't.
Two protocols dominate identity federation today:
They solve similar problems, authenticating users, but in radically different ways. Pick the wrong one, and you risk debugging nightmares, poor UX (especially on mobile), and brittle integrations.
Let’s walk through the differences, not just in theory, but in implementation, dev experience, and where each protocol wins.
It is important to know what SAML and OIDC do and more importantly, what they do not do before we get into how they work. Most developers confuse authentication and authorization protocols. This is usually confused with the OAuth 2.0 ecosystem, which OIDC and most authorization services build on.
Let’s untangle that first.
Authentication answers a simple question: ‘Who is this user?’ And it proves it, typically via credentials that yield a token.
Authentication is the process of verifying the credentials of a user when they enter them. The outcome is usually a token or statement that reads: “This is Alice and here are some of her verified qualities.”
Both SAML and OIDC are in this category. They are supposed to authenticate the identity of a user and pass the information to other systems (referred to as "Service Providers" or SPs) in a secure manner.
Authorization deals with access control. It answers the question:
"What is this user allowed to do?"
Once a user is authenticated, the system must decide what resources they can access. This could be implemented using scopes, roles, permissions, or policies.
OAuth 2.0 is an authorization protocol. It doesn’t care how the user logs in; it only cares about issuing access tokens to allow or deny resource access.
Here’s a quick way to remember the relationship:
And to drive the point home, OIDC is not OAuth. It is a separate spec built on top of OAuth 2.0 that defines how identity should be conveyed via an id_token.
In our fintech example, this distinction matters: the mobile app needs to authenticate the user (AuthN) quickly to start a session. In contrast, API calls within the app may need authorization scopes (AuthZ) to access user data.
Let’s start with the legacy protocol still powering many enterprise logins, including those used by the fintech’s B2B clients.
SAML (Security Assertion Markup Language) is a protocol that enables federated authentication between a Service Provider (SP) and an Identity Provider (IdP) using XML-based assertions. It is primarily used in enterprise environments for Single Sign-On (SSO), allowing users to log in once and access multiple systems without repeated credential prompts.
In large organizations, employees often interact with dozens of internal systems, HR portals, payroll tools, CRM platforms, procurement systems, and more. Managing credentials for each system individually becomes a security risk and a user experience bottleneck. SAML provides a centralized identity model, allowing companies to enforce authentication policies (e.g., MFA, session timeouts) at the IdP level while enabling seamless access across multiple apps.
SAML operates over HTTP using browser redirects, but the core protocol exchanges are structured XML documents. A typical SAML authentication flow involves passing AuthnRequest and SAMLResponse payloads between the Service Provider (SP) and Identity Provider (IdP) via HTTP POST or Redirect bindings. In more advanced configurations, such as artifact resolution, the protocol may also rely on SOAP over HTTP for backend communication.
A key aspect of SAML is its reliance on XML Digital Signatures and optional XML Encryption. In many enterprise use cases, assertions must be digitally signed to guarantee integrity and encrypted to protect sensitive user attributes. This adds a layer of security but also introduces significant complexity:
SAML’s architecture is ideal for enterprise B2B scenarios where:
That’s why the fintech startup continues to rely on SAML for its enterprise dashboard. Existing clients already have IdPs set up, and SAML enables seamless login via their corporate identity systems.
Here’s a truncated, decoded version of a typical SAML assertion sent via SAMLResponse to the Service Provider:
This response would be Base64-encoded and posted to your Assertion Consumer Service (ACS) endpoint.
For example, the fintech’s backend dashboard built in Node.js uses the passport-saml strategy to integrate with client-provided IdPs.
This approach abstracts most XML parsing and validation, but you’ll still need to handle certificate rotation, signature verification, and session indexing.
While SAML powers the B2B side, the startup’s mobile team needs something leaner especially for React Native and API-first flows. This is where OIDC fits in.
OIDC (OpenID Connect) is a modern, developer-friendly identity protocol designed for today’s mobile apps and cloud-native backends. It builds on top of OAuth 2.0 and extends it with authentication features like identity tokens (id_token) and standardized user profile claims.
If SAML was built for the enterprise web, OIDC is designed for microservices, SPAs, mobile apps, and API gateways, all with a REST-first, JSON-native architecture.
OIDC builds on OAuth 2.0’s flow, using the familiar authorize and token endpoints, and adds additional security through PKCE (Proof Key for Code Exchange). PKCE is particularly important for public clients, such as mobile apps or SPAs, that cannot securely store secrets. It helps ensure the integrity of authorization code exchanges and adds a layer of protection during the authentication process.
Key additions:
OIDC is built with modern needs in mind:
It’s also developer-friendly: no XML, SOAP, or Base64 gymnastics.
OIDC issues two major types of tokens:
A signed JWT that confirms the user’s identity and includes standard claims.
Example decoded id_token:
A bearer token used to access protected APIs. For example, Authorization: Bearer eyJhbGciOi...
Note: The access_token may or may not be a JWT; some providers use opaque tokens. Only the id_token
Few points to remember:
The mobile team builds their app in React Native. Here's how they integrate OIDC using oidc-client-ts.
After login, the IdP redirects the browser to your configured redirect_uri with the id_token and access_token in the URL hash. Your app can decode and use the JWT immediately:
Compared to SAML’s XML gymnastics, OIDC’s login is straightforward: JSON config, redirect, and done.
All OIDC-compliant IdPs expose a discovery document at:
https://<issuer>/.well-known/openid-configuration
Sample response:
Your frontend or backend client can fetch this once to auto-configure all necessary endpoints, eliminating hardcoded URLs and minimizing setup errors. This makes onboarding new IdPs faster, which matters as the startup grows its app into new regions and partners.
Here’s how the startup thinks about the tradeoffs across their stack: SAML for enterprise, OIDC for mobile.
The fintech startup didn’t have to rip out SAML to add mobile login. They used OIDC for the app and kept SAML for enterprise logins, bridging both with a unified session layer. Tools like Scalekit or Keycloak simplify this architecture.
SAML and OIDC both handle identity, but their approaches differ dramatically in transport mechanisms, token structure, client support, and ecosystem fit. Here’s a side-by-side breakdown that highlights not just theoretical differences, but the ones that affect implementation, debugging, and developer experience.
Developer considerations: SAML vs OIDC
Knowing the theoretical differences helps, but let’s translate that into decisions you’ll actually face during architecture planning or implementation.
1. You’re integrating with legacy enterprise systems: These systems (Oracle, SAP, PeopleSoft) often only expose SAML endpoints for federated identity.
2. You need intranet-heavy Single Sign-On: Large corporations use internal IdPs (e.g., ADFS, PingFederate) that provide SAML-based SSO. Employees expect a “one login across apps” experience.
3. Your IdP only supports SAML: Some systems, especially older HR, ERP, or government tools, lack OIDC support entirely. In these cases, you have no choice but to use SAML.
4. You're working in higher education or government: Projects involving Shibboleth, InCommon, or gov-federated identity portals still run exclusively on SAML 2.0.
1. You're building mobile-first or SPA-based apps: React/Vue apps and mobile clients work better with token-based flows, especially OIDC’s implicit or authorization code flow with PKCE.
2. You want to authenticate users in APIs or service meshes: OIDC allows identity propagation via JWTs in gRPC, REST, or GraphQL. Perfect for zero-trust environments.
3. You’re leveraging OAuth scopes and RBAC: OIDC plugs neatly into OAuth, making it easy to control API access levels with granular scopes (read:users, write:orders, etc.).
4. You're using modern identity platforms: Tools like, Firebase, Cognito, and Supabase are optimized for OIDC. They offer SDKs, refresh tokens, and SPA integrations, no XML config required.
While both protocols enable federated login, the way they handle identity transmission and session negotiation is fundamentally different. Below are two simplified yet technically accurate walkthroughs of how OIDC and SAML handle an authentication transaction, from redirect to token consumption.
OIDC is centered around standard HTTP endpoints and JSON Web Tokens. It’s natively supported by browsers, APIs, mobile apps, and modern frontend frameworks. OIDC often uses redirect URIs for frontend apps and callback URIs for backend apps, which could help reinforce the distinctions in app types
1. App redirects to the Identity Provider (IdP)→Typically to the /authorize endpoint with:
2. User authenticates and grants consent→ The IdP handles login via UI (password, MFA, etc.)
3. IdP redirects back with tokens→ Usually to /callback with:
4. App validates the id_token→ Verifies its signature using the IdP’s public key (from /.well-known/openid-configuration → jwks_uri)
5. Extract user claims and start session→ Store in-memory or persist based on your auth architecture.
Pros: Lightweight, stateless, debuggable
Cons: Logout handling is inconsistent across IdPs
SAML relies on signed XML documents and a browser-driven relay flow, usually coordinated between two HTTP endpoints: the SP’s Assertion Consumer Service (ACS) and the IdP’s SSO endpoint.
1. App initiates SAML AuthnRequest→ Constructs a signed XML request (optionally compressed + Base64-encoded) and redirects the browser to the IdP's SSO URL with:https://idp.example.com/sso?SAMLRequest=<base64-encoded-request>
2. User logs in at IdP
3. IdP posts SAMLResponse to ACS endpoint→ Typically as an HTML POST with SAMLResponse in the body.
4. App parses and verifies the assertion
5. Establish session based on the assertion contents
Pros: Deep support in enterprise IdPs, better for SSO across internal apps
Cons: Verbose, XML-based, poor mobile support, hard to debug manually
SAML and OIDC aren’t competing protocols; they’re purpose-built for different ecosystems. Use SAML when integrating with legacy systems, enterprise SSO workflows, or government and academic IdPs where federated XML assertions are the norm. Choose OIDC when you're building mobile apps, SPAs, or distributed services that need lightweight, token-based identity and flexible session handling.
In real-world architectures, supporting both is often essential. That's why Scalekit natively supports both SAML and OIDC, allowing platform teams to bridge old and new identity systems with unified session management, role mapping, and downstream claim normalization.
Try out Scalekit’s identity gateway to abstract protocol differences and standardize identity downstream. You can also check Scalekit Docs on SAML integration and OIDC setup to get started quickly.
Not inherently. Both are secure when implemented correctly.
However, OIDC:
Yes, tools like Keycloak, or custom gateways can act as federation bridges, converting a SAML response into an OIDC-compatible token set.
This is useful when:
Yes. Both provide endpoints and metadata for SAML and OIDC, you can choose either during integration.
Think of OIDC as a thin layer that gives you id_token, discovery endpoints, and standardized scopes.