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:
- SAML 2.0: An XML-based heavyweight from the enterprise era
- OIDC (OpenID Connect): A JSON-over-HTTP spec layered on OAuth 2.0
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.
Understanding authentication and authorization
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.
1. Authentication (AuthN)
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.
2. Authorization (AuthZ)
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.
How they interact
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.
Introducing SAML (Security Assertion Markup Language)
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.
How SAML works: Protocol stack and flow
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:
- SPs and IdPs must correctly exchange and trust each other's X.509 certificates
- Signature validation and decryption require strict handling of XML namespaces, canonicalization, and transformation rules
- Small misconfigurations can lead to subtle and hard-to-debug errors during login or logout flows
Why it’s popular in enterprise SSO
SAML’s architecture is ideal for enterprise B2B scenarios where:
- Systems are on-prem or in hybrid clouds.
- Compliance standards demand verbose, auditable assertions.
- You need fine-grained control over session metadata, such as expiry, audience, and encryption.
- The identity provider is part of a corporate domain (e.g., Active Directory or LDAP behind ADFS).
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.
Example: SAML assertion structure
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.
Implementing SAML: Node.js integration example
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.
Introducing OIDC (OpenID Connect)
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.
Built on OAuth 2.0 with additional security for authentication
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:
- id_token: A JWT (JSON Web Token is a compact, URL-safe format for representing claims) containing user identity claims (AuthN).
- .well-known/openid-configuration: Discovery document for client config.
- UserInfo endpoint: Optional API to fetch user attributes via access_token.
When to use OIDC in modern applications
OIDC is built with modern needs in mind:
- Single-page apps (SPAs) using React, Vue, etc.
- Works well with mobile apps like the fintech’s new mobile-first experience
- Service-to-service identity in microservices
- Easy integration with OAuth scopes and delegated permissions
- Lightweight enough for quick login without full-page redirects
It’s also developer-friendly: no XML, SOAP, or Base64 gymnastics.
Understanding OIDC tokens: id_token and access_token
OIDC issues two major types of tokens:
id_token – Authentication
A signed JWT that confirms the user’s identity and includes standard claims.
Example decoded id_token:
access_token: Authorization (OAuth 2.0)
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:
- Token introspection: It can be useful for checking the validity of tokens in a resource server
- Token revocation: Both SAML AND OIDC handles token revocation. SAML usually have short lived while OIDC uses OAuth 2.0 revocation endpoint
Implementing OIDC: React integration example
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.
Discovery and metadata example
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.
Real-world takeaway
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.
Key differences between SAML and OIDC
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
- Working in React, Vue, or Angular? You'll hate handling SAML redirects inside an SPA router. OIDC + PKCE (Proof Key for Code Exchange is a mechanism designed to enhance the security of the OAuth 2.0 Authorization Code grant) is designed for you.
- Need seamless SSO in a corporate dashboard? SAML is still the standard, especially where ADFS or internal IdPs are involved.
- Debugging or building internal auth gateways? OIDC’s transparency (via JWTs) makes it far easier to trace and verify issues.
When to use what: Practical scenarios

Knowing the theoretical differences helps, but let’s translate that into decisions you’ll actually face during architecture planning or implementation.
Use SAML if…
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.
Use OIDC if…
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.
OIDC and SAML flows: Side-by-side comparison
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 flow
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
Step-by-step
1. App redirects to the Identity Provider (IdP)→Typically to the /authorize endpoint with:
- client_id
- redirect_uri
- scope=openid profile email
- response_type=code (or id_token token in implicit flows)
- state, nonce, code_challenge (PKCE): PKCE mitigates code interception attacks, especially in public clients like mobile apps and SPAs that can’t store secrets securely
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:
- id_token (JWT)
- access_token (optional)\code (for Authorization Code flow)
- code (for Authorization Code flow)
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.
Decoding OIDC token
Pros: Lightweight, stateless, debuggable
Cons: Logout handling is inconsistent across IdPs
SAML flow
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.
Step-by-step
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
- Check signature, audience, and expiration
- Extract attributes like NameID, roles, department, etc.
5. Establish session based on the assertion contents
Parsing SAML responses in Node.js
Pros: Deep support in enterprise IdPs, better for SSO across internal apps
Cons: Verbose, XML-based, poor mobile support, hard to debug manually
Conclusion: Making the right protocol choice
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.
FAQs
1. Is OIDC more secure than SAML?
Not inherently. Both are secure when implemented correctly.
However, OIDC:
- Uses modern crypto (JWT, JWK, RS256)
- Is easier to audit/debug
- Has less surface for implementation bugs
2. Can I convert SAML to 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:
- You need to integrate legacy IdPs with modern apps.
- Your frontend requires JWTs but your IdP is SAML-only.
3. Do Google or Microsoft support both?
Yes. Both provide endpoints and metadata for SAML and OIDC, you can choose either during integration.
4. What’s the difference between OIDC and OAuth?
- OAuth 2.0: Authorizes third-party apps to access APIs.
- OIDC: Authenticates users, adds identity on top of OAuth.
Think of OIDC as a thin layer that gives you id_token, discovery endpoints, and standardized scopes.