JWT and SAML assertion grants
Sometimes a person has already signed in somewhere the authorization serverIn OAuth, the service that handles a person's sign-in and approval and decides which tokens to issue to a client. It may belong to the same company as the API, but its job is separate. 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 issuerThe party that creates and signs a token, assertion, or certificate, named in a token's iss claim. A recipient must check that the issuer is exactly the one it expected and trusts. for an access tokenA token that a client presents to an API to use access it has been granted, usually limited in what it allows and how long it lasts. It authorizes API calls; it does not tell the client who signed in., 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 providerA service that authenticates users and tells other applications about the sign-in, so those applications never handle the users' passwords. In OpenID Connect it is called an OpenID 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 flowThe main OAuth flow: the browser visits the authorization server, where the person signs in and approves access, then carries an authorization code back to the client, which exchanges it for tokens directly. When the client runs on a server, the tokens never pass through the browser.. 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 endpointThe authorization server address where clients exchange an authorization code, refresh token, or other grant for tokens, in a direct request rather than through a browser redirect. in place of an authorization codeA short-lived, single-use value that the authorization server sends back to a client through the browser. The client swaps it for tokens in a direct request to the authorization server; APIs never accept it.. If the authorizationDeciding whether a requested action is permitted, such as whether a signed-in account may delete a particular photo. Authentication says which account is asking; authorization decides what it can do. server trusts the issuer and the assertion passes its checks, it issues an access tokenA piece of data issued by a trusted service that a client presents as a credential, for example to call an API or to report a sign-in. Some tokens carry readable claims; others are random strings that only the issuer can interpret. 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 TokenA JSON Web Token: a compact token made of Base64url-encoded parts that carries claims and is usually signed. Anyone holding it can decode and read the claims, so the signature shows who issued it but hides nothing., the JWT you met in the JOSE lessons, is compact and widely used between services. A SAMLThe Security Assertion Markup Language, a federation standard widely used for workplace single sign-on, in which the identity provider sends the application a signed assertion about the user. assertion is written in XML and is common where an organization already uses SAML, an older XML-based standard, for single sign-onSigning in once and then using several applications without entering credentials again, usually because they all rely on the same identity provider.. 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.readLike 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
jtito 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.
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.
Try it in the Lab
- Exchange a trusted assertion for an access tokenSign typed assertions as Lantern's identity provider, make it a trusted issuer for Lab Photos, and see untrusted, misaddressed, replayed, unknown-person and access-token assertions refused.