Protecting an authorization response
With PARAn OAuth extension, RFC 9126, in which the client sends its authorization request straight to the authorization server and gets back a short-lived request_uri. The browser carries only that reference, so the parameters cannot be read or changed on the way. and JAR, the printer's request reaches the photo service intact and from a client the service can identify, but the answer still comes back the old way, as plain parameters in a redirect through Ava's browser. JARM has the photo service sign that answer too, so the printer can verify who wrote it and for whom before it uses the code.
An answer anyone can write
The photo service redirects Ava's browser to the printer's callback with a code, state and iss in the query string, and the printer reads them from the address her browser requests. That callback is an ordinary web addressA web address, such as https://photos.example/api/albums/42?limit=10. It names how to connect (https), the domain, the path to a particular page or resource, and any extra parameters after the question mark.. A request can reach it from the photo service's genuine redirect, from a link someone sent Ava, or from a browser extension that rewrote the address on the way. The parameters are plain text. Nothing in them shows that the photo service produced them, or that they arrived unchanged.
The printer is not defenseless. The 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. lessons gave it three checks, which Correlating requests and responses set side by side: state ties the response to a pending attempt in Ava's sessionThe ongoing connection between later requests and an earlier sign-in, so you are not asked for your password on every click. It is often tracked with a cookie holding an unpredictable session identifier., PKCEProof Key for Code Exchange, pronounced pixie: the client creates a secret for each authorization attempt, sends only a hash of it at the start, and proves it holds the secret when redeeming the code, so a stolen authorization code is useless to anyone else. ties the code to a verifier only the printer holds, and iss names the server that is supposed to have answered. Each answers one question well. None of them shows that the response as a whole came, unaltered, from the photo service and was meant for the printer. Even iss is just text that the response claims about itself.
For many deployments those checks are enough. A deployment that wants the response itself to be verifiable, the way a signed request object is, needs 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. to sign it.
Signing the response
The JWT Secured Authorization Response Mode for OAuth 2.0, known as JARM, is an OpenID Foundation specification that does exactly that. Instead of placing each response parameter in the redirect separately, the authorization server puts all of them into a JWT, signs it with its own private keyThe half of a key pair that its owner keeps to themselves and uses to create signatures or decrypt data. Anyone who obtains it can act as its owner., and sends the JWT as a single parameter called response.
The name comes from response modes. A response mode decides how an authorization server encodes the response it sends back through the browser. The default for the code flow puts the parameters in the query string, and other modes use the URL fragment or a form post. JARM adds a JWT version of each, and a client asks for one in its authorization request.
Asking for a signed response
All domains, codes, and keys in these examples are fictional. Before it relies on signed responses, the printer confirms in the photo service's metadata that the service supports them, and agrees on an algorithm:
Photo service metadata (excerpt):
{
"issuer": "https://auth.photos.example",
"response_modes_supported": ["query", "fragment", "form_post",
"query.jwt", "fragment.jwt", "form_post.jwt", "jwt"],
"authorization_signing_alg_values_supported": ["ES256"]
}
Printer registration (excerpt):
{
"client_id": "photo-printer",
"authorization_signed_response_alg": "ES256"
}The registration value matters more than it looks. When a client does not specify an algorithm for signed responses, JARM's default is RS256, an RSA algorithm. A service whose signing key is an elliptic curve key, as the photo service's is, and a client that never set the value can fail to agree on a signatureA value made with a private key that lets anyone holding the matching public key check that a message came from the key's holder and has not been changed. It proves origin and integrity; it does not hide the message. for reasons that have nothing to do with security.
The printer then adds one parameter to its authorization request:
https://auth.photos.example/authorize
?response_type=code
&client_id=photo-printer
&redirect_uri=https%3A%2F%2Fprinter.example%2Foauth%2Fcallback
&scope=photos.read
&state=demo-attempt-7
&code_challenge=qd-75t-gnweZAhIl6REjxxgFnPXGwvqYcxq3vlsaJYQ
&code_challenge_method=S256
&response_mode=jwtresponse_mode=jwt asks for a signed response in the default encoding for this response type. The parameter is part of the request like any other, so a printer that pushes its requests or signs them puts it in the pushed request or the request object instead of the URL. Nothing changes for Ava: she selects Connect, signs in and approves, as before.
Reading the response
After Ava approves, the photo service redirects her browser to the callback:
HTTP/1.1 302 Found
Location: https://printer.example/oauth/callback?response=eyJhbGciOiJFUzI1NiIsImtpZCI6InBob3Rvcy0yMDI2LTA5In0.eyJpc3MiOiJodHRwczovL2F1dGgucGhvdG9zLmV4YW1wbGUiLCJhdWQiOiJwaG90by1wcmludGVyIiwiZXhwIjoxNzkwODQ1NTAwLCJjb2RlIjoiZGVtby1jb2RlLTciLCJzdGF0ZSI6ImRlbW8tYXR0ZW1wdC03In0...The signature is shortened here for display. There is no code, state, or iss parameter beside it. The query string holds a single parameter, response, and everything else is inside. Decoded, the JWT reads:
Header:
{
"alg": "ES256",
"kid": "photos-2026-09"
}
Claims:
{
"iss": "https://auth.photos.example",
"aud": "photo-printer",
"exp": 1790845500,
"code": "demo-code-7",
"state": "demo-attempt-7"
}The header names the algorithm and the key, one of the signing keys in the photo service's published key setA JSON document, published at a fixed HTTPS address, that lists an issuer's current public keys so others can verify its signatures. It never contains private keys. at https://auth.photos.example/jwks. The first three claims protect the response, and every JARM response carries them. iss names the authorization server that created it, the same value the plain iss parameter has carried since Redirects and authorization codes. aud names the client it is meant for, by client ID. Compare that with the request object in Building a request object, whose aud named the authorization server: each signed message is addressed to the party that should accept it. exp limits how long the response is valid. Here it is 2026-10-01 09:05 UTC, five minutes after the response was issued at 09:00, and the specification recommends no more than ten minutes.
Then come the ordinary response parameters, code and state, with the same values as before. A response for another response type would carry that type's parameters in the same way, and a server may add further claims, which the client ignores if it does not recognize them.
Once the printer has verified the signature with the photo service's key, it has four assurances. The parameters are exactly as the photo service wrote them, because any change breaks the signature. The photo service produced them, because only it holds the signing key. They were addressed to the printer, so a response issued to another client is refused. And the server that answered is named inside the signature, which protects against the mix-up attacks that the iss parameter also addresses.
Decoding is not validating, though. Anyone can read these claims, and anyone could write a JWT that contains them. The printer uses none of them until the checks in Response validation and failures have passed.
Choosing a response mode
JARM defines four response modes:
| Response mode | Where the JWT travels |
|---|---|
query.jwt | In the response parameter of the callback's query string. |
fragment.jwt | In the URL fragment, after #. Browsers do not send the fragment to the server, so script on the callback page has to read it. |
form_post.jwt | In the body of a form that the browser posts to the callback. |
jwt | The default encoding for the response type: query.jwt for the code flow, and fragment.jwt for response types that return tokens from the authorization endpoint. |
The printer's jwt therefore meant query.jwt. The query string is acceptable for a response that carries a code, which is single-use and protected by PKCE. It is not acceptable for responses that carry tokens: the specification forbids query.jwt for response types that return access tokens or ID tokens from the authorization endpoint, unless the JWT is encrypted.
With form_post.jwt, the photo service answers Ava's browser with a small page that submits itself:
HTTP/1.1 200 OK
Content-Type: text/html;charset=UTF-8
Cache-Control: no-cache, no-store
<html>
<body onload="document.forms[0].submit()">
<form method="post" action="https://printer.example/oauth/callback">
<input type="hidden" name="response" value="eyJhbGciOiJFUzI1NiIsImtpZCI6InBob3Rvcy0yMDI2LTA5In0...">
</form>
</body>
</html>The JWT then reaches the printer in a POST body, so it stays out of the address bar, browser history, and the Referer header. One side effect catches teams out when they switch. As Request correlation and CSRF noted, a form posted from another site does not carry SameSite=Lax cookies, so the cookieA small value that a website asks the browser to store and send back with later matching requests. Cookies commonly carry a session identifier, so the site can recognize an ongoing sign-in without your password. that identifies Ava's pending attempt must be set up for that case, or the printer will find it missing at its callback.
Whichever mode carries it, the JWT is the same, and so are the checks the printer applies before it touches the code.
Encrypting the response
A signed response is still readable. Anyone who sees the redirect, or finds it later in history or a log, can decode the JWT and read the code inside it. JARM therefore allows the server to encryptTransforming data so that only someone holding the right key can read it. It protects confidentiality and, unlike hashing, is designed to be reversed by the key holder. the signed JWT as well, using a public encryption key the client has registered, so that only the client can open it. As with request objects, the order is sign first, then encrypt.
Encryption hides what the response says, not the response itself. An encrypted response that leaks can still be copied and delivered again as a whole, so it does not remove the need for PKCE. Many deployments that sign their responses do not encrypt them, because a response that carries only a code holds nothing confidential that PKCE does not already protect: the code is useless without the verifier, which never leaves the printer. The FAPI 2.0OpenID Foundation security profiles that fix how OAuth and OpenID Connect are combined for high-risk APIs, such as open banking. FAPI 2.0 requires choices such as PAR, PKCE and sender-constrained tokens, and conformance tests check that a deployment follows them. Message Signing profile makes exactly that argument. Signed authorization responses are one of the features it defines, each tested for conformance separately, so an ecosystem chooses whether to use them; a server that offers them must require and issue them. It says encrypting them is not needed and not recommended, since a code-only response has nothing in it to hide.
What a signature cannot tell
A signature proves who wrote a response and for which client. It cannot prove which browser session the response belongs to.
Return to the forged callback from Request correlation and CSRF, this time with JARM in place. The attacker connects their own photo account in their own browser and stops just before the callback. The photo service has produced a perfectly genuine, signed response: issued by the photo service, addressed to photo-printer, unexpired. When the attacker gets Ava's browser to deliver it to the printer, every JARM check passes. What stops the attack is what stopped it before: the state inside does not match a pending attempt in Ava's session, and the code cannot be exchanged without the attacker's verifier.
code, state, iss
- Written by the photo service
- Claimed by iss
- Meant for photo-printer
- Not stated
- Ava's attempt
- state and PKCE match
Used after state and PKCE
One signed JWT
- Written by the photo service
- Proved by the signature
- Meant for photo-printer
- aud: photo-printer
- Ava's attempt
- state and PKCE match
Used after every check
Attacker's own response
- Written by the photo service
- Proved by the signature
- Meant for photo-printer
- aud: photo-printer
- Ava's attempt
- No, state differs
Refused by state and PKCE
A signature proves who wrote a response and for which client, not which browser session it belongs to.
So JARM adds to the printer's checks rather than replacing any of them. It also adds less evidence than the signed request did. A signed request records what a client asked for, such as a payment of 42.50 EUR. A signed response records a code and a state, values that only mean something inside one protocol exchange.
That balance explains where JARM is used. As with request objects, the FAPI profiles moved from requiring signed responses to offering them. FAPI 1.0 Advanced required them. The FAPI 2.0 Security Profile keeps the response to a code protected by PKCE and the iss parameter, and leaves JARM to its message signing profile for deployments that want every message signed.
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
- Read a plain authorization response, then ask for and verify signed onesCapture lab-printer's plain response and write one by hand, then ask for signed JWT responses, verify them against the tenant's keys, agree an algorithm, and receive them by query, form post and fragment.