Pushing an authorization request
When Ava selects Connect, the printer builds an authorization request and hands it to her browser to deliver, so every value in it can be read, recorded or changed before the photo service sees it. Pushed Authorization Requests send the request straight from the printer's backend to the photo service instead, with client authenticationChecking evidence that someone, or some application, controls an account, such as a password or a passkey. It establishes which account is being used, not what that account may do., and leave the browser carrying only a reference.
A request in plain sight
The authorization request read the printer's request one parameter at a time: the scope, the return address, state and the 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. challenge. Every one of those values travels in Ava's address bar before the photo service sees any of it. That arrangement is simple, and it has served every flow so far, but it means the printer cannot control what happens to its request on the way.
Earlier lessons kept tokens out of addresses for good reason. As Using access tokens explained, a URLA 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. is kept in browser history, written to server and proxy logs, and can be passed to other sites in the Referer header. An authorization request is a URL too, so everything in it is exposed in the same ways.
For the printer's request, that exposure is tolerable. The scope and return address are not secrets, and the PKCE challenge is designed to be seen. Other requests carry more. A request might include Ava's email address so the sign-in page can fill it in, or describe a payment she is about to approve, with an amount and a recipient. Those details then sit wherever the URL was recorded.
A URL also has to fit. Browsers, web servers and proxies all limit the length of an address, and their limits differ. A request that describes access in detail can grow past what some part of the path will accept, and the failure then appears somewhere the printer cannot see.
A request anyone can change
Redirect URI validation began with an attacker writing an authorization request of their own. The printer's client ID is public, so anyone can build a URL that names photo-printer. Exact matching kept that attacker from choosing the return address, and the photo service checks the other parameters against the printer's registration as well, so a scope the printer may not request is refused too.
Within those limits, though, the photo service cannot tell which values the printer chose. If the printer is registered for both photos.read and photos.write, a request edited to ask for both looks just as legitimate as one the printer built. The edit can come from a malicious browser extension that rewrites the address on its way, or from an attacker who starts a connection in their own browser and changes the request before sending it on. For a request that names a payment, an edit could change the amount or the recipient, and the person approving it might not notice.
A request written from scratch fares no better. Sent to Ava in a message, it would show the photo service's familiar consent screen, with the printer's name on it, for a request the printer never made.
Checks that come too late
Client authentication methods explained why the authorization request carries no client credential: it travels through a browser, where a credential would be exposed. The consequence is that the first time the photo service can confirm the printer's identity is the 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. request, after Ava has signed in and approved the connection.
By then, a request that should never have been accepted has already put a sign-in page and a consent screen in front of her. If the service finds a problem it can report, it sends her browser back to the printer with an error, which costs another round trip through the browser just to say that the request was bad.
Sending the request directly
Pushed Authorization Requests, usually called PAR and published as RFC 9126 in 2021, change the route the request takes. The printer's backend sends the authorization request parameters straight to the photo service in an HTTPSHTTP protected by TLS, so traffic is encrypted and checked for changes while it travels. It protects the connection, but does not prove that the site at the other end is honest. POST and authenticates exactly as it does 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.. The service checks the client and the request, stores the request, and returns a short-lived reference to it, called a request URI. Only then is Ava's browser involved, and it carries just the client ID and that reference.
The photo service accepts these requests at its pushed authorization request endpoint, often shortened to PAR endpoint, at https://auth.photos.example/par. The printer has the address in its configuration for the photo service. The service also lists it under pushed_authorization_request_endpoint in its metadata, a JSONA text format for structured information, written as named values inside curly braces. APIs, tokens, and discovery documents all use it. document it publishes about its own endpoints and features, which Authorization server metadata describes in full.
Each weakness from the sections above has an answer in the new route. Read the table one row at a time, from the problem to what changes:
| Weakness | With a pushed request |
|---|---|
| Parameters visible and recorded in the browser | The browser carries an opaque reference instead of the parameters. |
| Parameters changed or forged in the browser | The parameters never pass through the browser, and only the authenticated printer can push a request in its name. |
| Requests too long for a URL | The request travels in a POST body, and the URL stays short whatever the request contains. |
| Client verified only at the token request | The client authenticates before Ava sees any page, so the service can refuse a bad request without involving her. |
Sending the request
All domains, credentials and identifiers in these examples are fictional. The printer pushes the same request it used to put in the address bar:
POST /par HTTP/1.1
Host: auth.photos.example
Authorization: Basic cGhvdG8tcHJpbnRlcjpkZW1vLW9ubHktbm90LWEtcmVhbC1zZWNyZXQ=
Content-Type: application/x-www-form-urlencoded
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=S256The body is form-encoded, as in a token request, and its line breaks are for display only. The parameters are exactly those of the authorization request: the response type, client ID, return address, scope, state and PKCE challenge. Any extension parameter the printer could send to the authorization endpoint can be pushed in the same way.
The Authorization header is the printer's ordinary client authentication, the same client_secret_basic header it sends to the token endpoint, and the rules for that endpoint apply here unchanged, including the method recorded in the printer's registration. A client registered for signed assertions, as described in Secrets and signed assertions, sends a client assertion instead. Its aud is the server's issuer identifierThe 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., as at the token endpoint. RFC 9126 still tells servers to accept the token endpoint URL or the PAR endpoint URL there too, but the current guidance that lesson described, which updates RFC 9126 as well, narrows the PAR endpoint to the issuer identifier alone.
Notice that client_id still appears in the body, although the header names the printer too. In the body it belongs to the authorization request, which always names its client. In the header it is part of a credential. Both name photo-printer, and a careful server refuses a push in which they disagree.
The body carries an authorization request and nothing else. The specification rules out one authorization parameter by name: request_uri, the reference this endpoint is about to hand out, because a push must not point to another stored request. Token request parameters such as grant_type or code have no meaning here either, since the body is not a token request. The only additions are client authentication parameters, which are used only to authenticate.
A public clientAn OAuth client, such as code running in a browser or an app on a phone, that cannot keep a credential secret because the people using it can inspect it. It relies on protections such as PKCE instead of a client secret. can push as well. The printer's phone app would send a similar body under its own client ID, photo-printer-app, with no credential, because it has none to send. It still keeps its parameters out of the browser and gets a short URL, but the service cannot authenticate it here any more than it could at the token endpoint.
What the server checks
When the push arrives, the photo service works through it in order:
- Authenticate the client as it would at the token endpoint. If the printer's secret was replaced and one of its servers still has the old one, the push fails here with
invalid_client, before Ava has seen a single page. - Refuse a push that contains
request_uri. - Validate the parameters as an authorization request. The return address must match one registered for this client, the scope must be one the printer may request, the response type must be allowed, and a PKCE challenge must be present if the service requires one.
This is where the checks that came too late move to the front. The service knows which client is asking and whether its request is acceptable before anyone is sent to a sign-in page. A request that fails is refused in a direct response to the printer's backend, and Ava is never involved.
A service may postpone a check it cannot perform yet, but it must then perform that check when Ava's browser arrives at the authorization endpoint. Nothing about signing in or consent is decided here either, because Ava has not been asked anything. Those decisions still happen in her browser, later.
The request URI it returns
When the checks pass, the service stores the request and answers:
HTTP/1.1 201 Created
Content-Type: application/json
Cache-Control: no-cache, no-store
{
"request_uri": "urn:ietf:params:oauth:request_uri:demo-pushed-request-7",
"expires_in": 90
}The status is 201 Created because the service has created something: a stored authorization request. The request_uri refers to it. Despite the name, it is not an address the printer or anyone else can fetch. It is a URN, a uniform resource name: an identifier written in URI syntax that names something without saying where to retrieve it. The urn:ietf:params:oauth:request_uri: prefix is a standard form that servers may use, and the rest is up to the server. A real value must contain a part generated with a cryptographically strong random generator so that nobody can guess it. demo-pushed-request-7 is a readable stand-in.
expires_in gives the reference's lifetime in seconds. Ninety seconds is this example's choice. The specification leaves it to the server and expects it to be short, typically somewhere between a few seconds and ten minutes. The reference is also bound to the client that pushed it, so only photo-printer can use it.
The printer saves the request URI with the pending attempt, next to the PKCE verifier, and sends Ava's browser on at once. The reference is not a secret in the way the verifier is, because her browser is about to carry it. It is simply good for one attempt and a short time.
PAR changes the request, not the rest of the flow. The authorization response still returns through Ava's browser with a code, state and iss, and the printer checks it as before. The code exchange is unchanged. What differs is what her browser carries to the authorization endpoint: a client ID and this reference, and nothing else.
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
- See what a browser-carried request exposes, then push it from the back endEdit and hand-build authorization requests for lab-printer, see the client authenticate only at the token request, then push the request with client authentication and see bad pushes refused first.