Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

JWT and SAML assertion grants

Sometimes a person has already signed in somewhere the authorization server trusts, and asking them to approve access again would repeat a decision already made. An assertion grant lets a client trade a signed statement from that trusted issuer for an access token, provided the trust was arranged in advance and the statement passes every check.

Bringing proof from somewhere else

Lantern Studio, a small design agency, keeps its client photo shoots in a business account with the photo service. Its designers sign in each morning to the agency's project portal through Lantern's own identity provider, the service that signs Lantern's people in for all of its applications. When a designer opens a project, the portal should show that designer the photos they are allowed to see.

The portal could send each designer through the photo service's authorization code flow. But Lantern has already authenticated them, and Lantern's administrator has already agreed with the photo service which designers may see which shoots. Another round of redirects and approval screens would repeat a decision that has been made.

An assertion is a signed statement from an issuer about a subject, such as "this is designer-42, and Lantern's identity provider vouches for it until 09:05." The assertion grants let a client present an assertion like that at the token endpoint in place of an authorization code. If the authorization server trusts the issuer and the assertion passes its checks, it issues an access token directly.

That trust has to be arranged in advance. For this example, the photo service has been configured to accept assertions signed by Lantern's identity provider, for designers in Lantern's business account, when presented by Lantern's portal. Without that arrangement, a well-formed assertion from Lantern would mean nothing to the photo service, just as a letter of introduction means nothing from someone you've never heard of.

Two formats are common. A JSON Web Token, the JWT you met in the JOSE lessons, is compact and widely used between services. A SAML assertion is written in XML and is common where an organization already uses SAML, an older XML-based standard, for single sign-on. The idea is the same in both, and so are most of the checks.

Presenting a JWT

When a designer opens a project, the portal asks Lantern's identity provider for an assertion about that designer, addressed to the photo service. The assertion grant specifications leave that request to the identity provider, so each one offers its own way to make it. Lantern's identity provider returns a short-lived JWT. Decoded, its claims might read:

{
  "iss": "https://idp.lantern.example",
  "sub": "designer-42",
  "aud": "https://auth.photos.example",
  "iat": 1790758800,
  "exp": 1790759100,
  "jti": "demo-assertion-61"
}

All domains, credentials, assertions and tokens in these examples are fictional.

iss names the issuer, and sub names the designer, using Lantern's identifier for them. aud names the photo service's authorization server as the intended recipient, using its issuer identifier; the JWT grant specification, RFC 7523, also allows the token endpoint's URL here, and the trust arrangement settles which value the photo service accepts. iat and exp record when it was issued and when it expires, five minutes apart. jti gives this assertion a unique identifier, so the server can recognize it if it comes back. The whole token is signed with a key that belongs to Lantern's identity provider.

The header matters too. An access token Lantern's identity provider issued for some other API is also a signed JWT about the designer, and an authorization server shouldn't accept it as a grant merely because it trusts the signer. As the JOSE lessons showed with at+jwt, the JWT best practices in RFC 8725 recommend giving each kind of JWT its own typ, so one kind can't be passed off as another. The Identity Assertion Authorization Grant, a draft specification at the Internet Engineering Task Force (IETF), the standards organization where OAuth's specifications are written, made for exactly this enterprise case, gives these grants the type oauth-id-jag+jwt: a JWT meant only to be presented as a grant at the authorization server it names. In that draft the portal gets one by trading the designer's sign-in token at Lantern's identity provider, a standard request called token exchange.

The portal sends the assertion to the token endpoint:

POST /token HTTP/1.1
Host: auth.photos.example
Authorization: Basic bGFudGVybi1wb3J0YWw6ZGVtby1vbmx5LW5vdC1hLXJlYWwtc2VjcmV0
Content-Type: application/x-www-form-urlencoded

grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer
&assertion=eyJhbGciOiJSUzI1NiIsImtpZCI6ImxhbnRlcm4tMjAyNiJ9...
&scope=photos.read

Like the device grant, this grant has a URN for a name, here ending in jwt-bearer. The assertion is shortened for display. The portal also authenticates as a client with its own secret. The assertion speaks for the designer, and the client authentication speaks for the portal. Keeping both lets the photo service limit which applications may present Lantern's assertions.

A signed JWT appears in one more place that is easy to confuse with this one. A client can also use a signed JWT to authenticate itself instead of sending a secret. That JWT is about the client and travels in separate client authentication parameters. Here, the JWT is the grant: it is about the designer, and it takes the place of the authorization code. Secrets and signed assertions covers signed JWTs used for client authentication.

Presenting a SAML assertion

If Lantern's identity provider speaks SAML, it can issue a SAML assertion for the same purpose. A SAML assertion is an XML element, Assertion, that makes the same kind of statement as the JWT. It is signed with an XML signature, the ds:Signature element that XML and XML signatures taught you to read, and the saml: and ds: prefixes only say which vocabulary each element belongs to. A heavily abbreviated assertion shows the parts that matter here:

<saml:Assertion ID="demo-assertion-62" IssueInstant="2026-09-30T09:00:00Z">
  <saml:Issuer>https://idp.lantern.example</saml:Issuer>
  <ds:Signature>...</ds:Signature>
  <saml:Subject>
    <saml:NameID>designer-42</saml:NameID>
    <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
      <saml:SubjectConfirmationData
        Recipient="https://auth.photos.example/token"
        NotOnOrAfter="2026-09-30T09:05:00Z"/>
    </saml:SubjectConfirmation>
  </saml:Subject>
  <saml:Conditions>
    <saml:AudienceRestriction>
      <saml:Audience>https://auth.photos.example/token</saml:Audience>
    </saml:AudienceRestriction>
  </saml:Conditions>
</saml:Assertion>

The same questions have different spellings. Issuer says who vouches, like iss. NameID, inside Subject, names the designer, like sub. ID identifies this assertion, like jti, and IssueInstant says when it was written. SubjectConfirmation says how a recipient can tell the presenter is entitled to use the assertion; the bearer method means whoever holds it may present it, the same as a bearer token. Its Recipient and the Audience under Conditions both name the photo service's token endpoint, and NotOnOrAfter is the deadline.

The portal base64url-encodes the XML, so it fits in a form field, and sends it in the assertion parameter with the grant type urn:ietf:params:oauth:grant-type:saml2-bearer.

Look closely at the audience. When the designer signed in to the portal that morning, Lantern's identity provider gave the portal an assertion too, and that one was addressed to the portal. This one is addressed to the photo service. An assertion is written for a particular recipient, and a recipient should reject one addressed to someone else, even if the signature is genuine. The portal can't simply forward its own sign-in assertion.

What the server checks

Before issuing anything, the photo service's authorization server works through the assertion:

  • The issuer is one it has been configured to trust, and the signature verifies with that issuer's key.
  • The type, where the arrangement expects one, says this is a grant and not some other kind of token.
  • The audience names this authorization server.
  • The assertion hasn't expired, and it isn't being used before it became valid.
  • It hasn't been seen before, when the server tracks identifiers such as jti to stop replays.
  • The subject maps to an account covered by the trust arrangement, here a designer in Lantern's business account.
  • This client is allowed to present assertions from this issuer, and the requested scope fits the arrangement.

Notice what is missing: nobody saw a consent screen. The authority for this access comes from the arrangement Lantern's administrator made with the photo service. That is appropriate for an organization's own accounts, and it is why the arrangement should be narrow. It should name the issuers, the accounts they may speak for and how each one is found, the clients that may present their assertions, and the scopes available. An identity provider trusted to vouch for Lantern's designers shouldn't be able to vouch for Ava's personal photo account, even if a designer's email address happens to match hers.

These are bearer assertions. Anyone who obtains one can present it, so they are short-lived and addressed to one recipient, and the portal treats them as carefully as tokens. The access token that comes back is an ordinary access token. The photo API never sees the assertion and validates the token as usual.

The assertion and client authentication identify different parties: the designer and the portal. The authorization server validates both before issuing the token in this example.

Assertion grants turn one kind of trusted statement into an access token. Token exchange, covered in Advanced OAuth from The problem token exchange solves onward, generalizes the idea to trading one token for another with a different audience or scope.

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

Lantern's portal received a signed SAML assertion addressed to the portal when a designer signed in. Can it present that assertion at the photo service's token endpoint? 1 of 3

Choose one answer.

No consent screen appears in an assertion grant. Where does the authority for the access come from? 2 of 3

Choose one answer.

Lantern's portal holds an access token that Lantern's identity provider issued for another API. It is a signed JWT about the designer. Should the photo service accept it as a grant? 3 of 3

Choose one answer.

Try it in the Lab

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow all", you consent to optional analytics. Cookie Policy

Learn identity