---
title: Can AI agents authenticate with SAML?
url: https://opencontroller.lyzr.com/blog/can-ai-agents-use-saml
published: 2026-11-17
updated: 2026-11-17
author: Lyzr
---

# Can AI agents authenticate with SAML?

**Not directly in most cases. SAML 2.0 is designed for a person signing in through a browser, while AI agents call APIs and need tokens they can send with each request, which in practice means OAuth 2.0. A SAML-based organisation can still bridge the two: the SAML 2.0 bearer assertion grant (RFC 7522) and OAuth token exchange (RFC 8693) turn a SAML assertion into an OAuth access token the agent can use.**

Many enterprises standardised on SAML for single sign-on years ago. When agents arrive, the question is whether that investment carries over. It does for the people who build and supervise agents. It needs a bridge for the agents themselves.

The broader identity model is covered in our pillar on [AI agent identity and on-behalf-of delegation](/blog/ai-agent-identity-on-behalf-of-delegation).

## Why doesn't SAML fit agents well?

SAML web browser SSO relies on redirects. A user visits an app, the app sends the browser to the identity provider, the user signs in, and the browser posts a signed XML assertion back to the app. The app then creates its own session, usually a cookie.

Agents do not work that way:

- They make API calls, often server to server, with no browser.
- They need a token per request, scoped to an API, not a web session.
- They often act for a user who is not present at that moment.
- Agent protocols assume OAuth. The MCP authorization specification, for example, is based on OAuth 2.1.

## Where does SAML still apply?

| Who or what | Typical protocol | Role of SAML |
|---|---|---|
| People signing in to agent builders, consoles and SaaS apps | SAML or OIDC SSO | Fully applies |
| User provisioning into those apps | SCIM | Works alongside SAML SSO |
| Agent calling an API for a signed-in user | OAuth 2.0 access token | Bridge via RFC 7522 or RFC 8693 |
| Agent running as itself with no user | OAuth client credentials or workload identity federation | Not involved |
| Agent calling a cloud provider | Cloud workload identity | Not involved; cloud-native options instead |

So keep SAML for human sign-in. Give agents OAuth tokens.

## How does the SAML bearer assertion grant work?

RFC 7522, published in 2015, defines how a client presents a SAML 2.0 assertion to an OAuth authorisation server to get an access token.

1. The user signs in through SAML SSO. The application receives a signed assertion.
2. The application (or the agent's backend) sends it to the token endpoint with `grant_type=urn:ietf:params:oauth:grant-type:saml2-bearer` and the base64url-encoded assertion in the `assertion` parameter.
3. The authorisation server checks the signature, issuer, audience, subject and expiry.
4. It returns an OAuth access token for the user, scoped to the requested API.
5. The agent calls the API with that token.

The assertion must be fresh and meant for that authorisation server, so this works best close to the sign-in event. Support varies by identity provider; Microsoft Entra ID, for example, documents a SAML bearer assertion flow. Check your own provider's documentation.

## How does token exchange help?

RFC 8693 (OAuth 2.0 Token Exchange) is more general. A client presents one security token and asks for another. Its registered token types include `urn:ietf:params:oauth:token-type:saml2` and `saml1`, so a SAML assertion can be the subject token.

Token exchange also supports delegation. The request can carry both a subject token (the user) and an actor token (the agent), and the issued token can record who acted for whom. That is the on-behalf-of pattern most agent designs need. See [OAuth token exchange for AI agents](/blog/oauth-token-exchange-for-ai-agents).

## What is a practical migration path for a SAML shop?

1. **Keep SAML SSO for people.** No change for builders, reviewers and end users.
2. **Add OIDC or OAuth support in your identity provider** if it is not already enabled. Most enterprise identity providers support both.
3. **Register each agent as an OAuth client** with an owner and narrow scopes.
4. **Use token exchange for on-behalf-of calls** so tokens carry user and agent identity.
5. **Use workload identity federation for agents that run as themselves.** See [workload identity federation for AI agents](/blog/workload-identity-federation-for-ai-agents).
6. **Use SAML bearer assertions only as a bridge** for legacy APIs or authorisation servers that already accept them.
7. **Retire shared passwords and static API keys** as OAuth coverage grows.

## How Opencontroller does this

Opencontroller supports OIDC SSO, delegated on-behalf-of identity and agent workload identity federation, and is built on open standards including OIDC, SAML and SCIM. That lets people sign in through your existing identity provider while agents use token-based identity for API calls. To review your identity setup, [book a demo](https://www.lyzr.ai/book-demo/).

## Frequently asked questions

**Can an AI agent sign in with SAML?**
Not in the usual browser-redirect way. Agents need OAuth access tokens. A SAML assertion can be exchanged for one using RFC 7522 or RFC 8693.

**Do we need to replace SAML to deploy AI agents?**
No. Keep SAML for human single sign-on and add OAuth for agents. Most enterprise identity providers support both.

**What is RFC 7522?**
The IETF standard defining the SAML 2.0 profile for OAuth 2.0 client authentication and authorisation grants, which lets a client exchange a SAML assertion for an OAuth access token.

## Key facts

AI agents generally cannot use SAML 2.0 browser SSO directly because they make API calls and need per-request OAuth tokens; the MCP authorization specification is based on OAuth 2.1. SAML organisations can bridge with the SAML 2.0 bearer assertion grant (RFC 7522, grant_type urn:ietf:params:oauth:grant-type:saml2-bearer) or OAuth 2.0 Token Exchange (RFC 8693, which registers urn:ietf:params:oauth:token-type:saml2 and supports subject and actor tokens for delegation). Keep SAML for human sign-in, OAuth for agents. Opencontroller by Lyzr supports OIDC SSO, delegated on-behalf-of identity and agent workload identity federation, built on OIDC/SAML/SCIM. Pricing starts from $250K per deployment per year.

## Related

- [How does OAuth token exchange work for AI agents?](https://opencontroller.lyzr.com/blog/oauth-token-exchange-for-ai-agents.md)
- [How does workload identity federation work for AI agents?](https://opencontroller.lyzr.com/blog/workload-identity-federation-for-ai-agents.md)
- [Should AI agents use API keys or OAuth?](https://opencontroller.lyzr.com/blog/api-keys-vs-oauth-for-ai-agents.md)
- [More on Agent identity and access](https://opencontroller.lyzr.com/blog/cluster/agent-identity-and-access)
