Beta

Create a tenant

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

Using the request URI and handling failures

The printer holds a request URI that works for the next 90 seconds. It now sends Ava's browser to the photo service with nothing but that reference and its client ID, and the photo service has to turn the reference back into a request, refuse copies and strangers, and report failures in the right place.

Sending the browser

All domains, codes and identifiers in these examples are fictional. With its parameters on separate lines, the address the printer sends Ava's browser to is:

https://auth.photos.example/authorize
  ?client_id=photo-printer
  &request_uri=urn%3Aietf%3Aparams%3Aoauth%3Arequest_uri%3Ademo-pushed-request-7

Compare it with the request in The authorization request. There is no scope, no return address, no state and no PKCE challenge. All of them are stored at the photo service, where the push left them. The request URI is percent-encoded because it is a value inside another URL.

client_id is still required. It names the client whose request this is, and the service will check that it matches the client the reference was issued to. Anyone looking at the address bar can see that the printer wants to connect, but nothing there says what it asked for, and there is nothing to edit except a reference that only means something to the photo service.

What the server does with it

When Ava's browser arrives, the photo service turns the reference back into a request:

  1. It looks up the stored request. An unknown reference is rejected.
  2. It checks that the reference has not expired and has not already been used.
  3. It checks that the client_id in the address is the client that pushed the request.
  4. It processes the stored parameters as an authorization request.

The last step can be shorter than usual. The service validated the request when it was pushed, and it may skip those checks now if it can tell that this is a pushed request and that nothing has changed since that would alter the result. Something can change in 90 seconds. If the printer's registration was suspended, or its return address removed, between the push and Ava's visit, the service checks again and refuses.

Then the familiar part begins. Ava signs in if she needs to, and the consent screen, built from the stored request, asks whether Photo Printer may view her photos. When she approves, the response returns through her browser exactly as before:

https://printer.example/oauth/callback
  ?code=demo-code-7
  &state=demo-attempt-7
  &iss=https%3A%2F%2Fauth.photos.example

The printer checks state and iss against its pending attempt and exchanges the code with its verifier and client authentication. Because the pushed request contained a redirect_uri, the token request repeats it, just as it would have if the address had travelled in the browser. Nothing in the code exchange changes.

Single use and a short life

The request URI passes through Ava's browser, so it is exposed in the same ways any URL is. It can end up in history or a log, and someone who copies it could try to start the same authorization in a browser of their own. Four properties keep that from being useful.

Single use. Once the reference has been used, a copy is worth nothing. The specification says servers should treat request URIs as one-time use, and allows them to tolerate a repeated visit when someone reloads the page. Some servers apply the single use when the authorization is completed rather than when the page first loads, so that a link preview or a browser that fetches pages in advance does not use up the reference before Ava arrives.

A short lifetime. An unused reference stops working after its expires_in. The lifetime has to be long enough for a slow network or a phone that asks which browser to open, and short enough that a copy found later has already expired.

Bound to one client. Suppose an attacker registered their own client with the photo service, pushed a request naming their own return address, and then sent Ava a link carrying that reference with client_id=photo-printer. The consent screen would show the printer's name while the stored request sent the result to the attacker. The binding check in step 3 refuses that combination.

Unguessable. The random part of the reference means nobody can produce a valid one for a request they did not push.

Ava's browser

Within 90 seconds
Yes
Unused
Yes
Pushed by photo-printer
Yes

Sign in and consent

An hour later

Within 90 seconds
No
Unused
No, Ava used it
Pushed by photo-printer
Yes

invalid_request_uri

Their own reference

Within 90 seconds
Yes
Unused
Yes
Pushed by photo-printer
No, another client

Refused by the binding check

Parameters added beside a reference are ignored or refused.

The same three checks meet every arrival with a request URI. Only Ava's first visit, within the lifetime and from the client that pushed it, reaches the consent screen.

The printer has a matching duty: it uses each reference once. If Ava closes the photo service tab and selects Connect again, the printer pushes a new request rather than reusing the old reference. The stored request contains values that belong to one attempt, such as state and the PKCE challenge, and a new attempt needs new ones.

What the browser can still affect

PAR removed the parameters from the browser, but the browser still carries two things: the reference on the way in and the response on the way out.

An attacker who captured a request URI from someone else's attempt might try swapping it into Ava's, hoping her approval completes a request she never saw. That stored request carries the state and PKCE challenge of the attempt that created it. When the response comes back to Ava's session, the state does not match the printer's pending attempt for her, and the code cannot be redeemed without the other attempt's verifier. This is one reason a pushed request should always include state and a PKCE challenge, even though nobody can edit them in transit any more.

The response is unchanged by PAR. The code, state and iss come back in an ordinary redirect, readable and recordable like any URL, and the printer applies every check from Correlating requests and responses before it uses them. Protecting the response itself takes a different mechanism, the signed responses of Protecting an authorization response.

Errors from the push

So far every step has succeeded. A pushed request can fail in two places, and the failures look different, reach different parties and call for different responses. The first place is the push itself, refused in a direct response to the printer's backend.

Suppose a developer changed the printer's callback path in the code but not in its registration. The push fails:

HTTP/1.1 400 Bad Request
Content-Type: application/json
Cache-Control: no-cache, no-store

{
  "error": "invalid_request",
  "error_description": "The redirect_uri is not valid for this client"
}

The error uses the same JSON format as a token endpoint error, and its code comes from the token endpoint's list or the authorization endpoint's list, whichever fits. A return address problem is a useful case to notice. In the browser, that mistake would have left Ava on an error page at the photo service, because the service may not redirect to an address it cannot trust and the specification defines no error code for that case. At the PAR endpoint there is no redirect to worry about, so the service can say what went wrong, using invalid_request by default. Each row of the table pairs a response with its usual cause and what the printer should do next:

Errors a pushed request can receive and the printer's response to each
ResponseUsual causeThe printer's next step
400 invalid_requestA malformed request, or a return address not valid for this client.Treat it as a configuration fault. Retrying the same push will fail the same way.
401 invalid_clientClient authentication failed.Check the deployed credential against the registration, as for the token endpoint.
400 invalid_scope or unauthorized_clientThe printer asked for something its registration does not allow.Fix the request or the registration.
413The request is larger than the service accepts.Reduce the request.
429Too many pushes from this client in a period.Wait before trying again.

Some errors never come from this endpoint. Because nobody has been asked to sign in or approve anything yet, errors about signing in or consent are decided later, in the browser. A request sent with any method other than POST gets 405.

Whatever the error, Ava's browser has not gone anywhere. She is still on the printer's page, so the printer can tell her that it could not connect her photo account right now and record a safe diagnostic for its developers. It should not fall back to building an ordinary authorization URL, which would quietly give up the protection it chose PAR for.

Errors at the authorization endpoint

The second place is the browser's visit. The push succeeded, but the reference can still be refused for any of the reasons the server checks on arrival: it expired because Ava left the page open, it was used already, it never existed, or it belongs to a different client. PAR borrows the request_uri parameter and its processing rules from signed authorization requests, the subject of Building a request object, and those rules include an error code for a reference that cannot be used: invalid_request_uri.

Where that error goes depends on what the service still knows. The return address was part of the pushed request. If the service no longer holds that request, it has no validated return address for this attempt, so it typically shows its own error page instead of redirecting. The printer then receives no callback at all. Its pending attempt expires, and the next time Ava selects Connect it pushes a new request.

Two habits keep this rare. The printer pushes when Ava selects Connect, immediately before redirecting, rather than when it renders a page that might sit open for an hour. And the service chooses a lifetime that allows for a slow phone opening a browser.

Once a valid stored request has been loaded, later failures behave as they always have. If Ava denies access, the error returns to the printer's callback with state and iss, and the printer validates it before showing a message, as in Errors and denied access.

Parameters in two places

The printer sends only client_id and request_uri to the authorization endpoint. Suppose someone edits the address in the browser to add more:

https://auth.photos.example/authorize
  ?client_id=photo-printer
  &request_uri=urn%3Aietf%3Aparams%3Aoauth%3Arequest_uri%3Ademo-pushed-request-7
  &scope=photos.read%20photos.delete

The added scope has no effect. Under the borrowed rules, the service uses only the parameters it stored for the reference. Values added to the URL are ignored, and a stricter service refuses a request that carries them. Either way, an edit in the browser cannot change what the printer pushed. High-assurance profiles go further and require clients to send nothing but client_id and request_uri to the authorization endpoint. client_id is the one value that appears in both places, which is why the binding check insists that the two agree.

Requiring PAR and choosing return addresses

A service that offers PAR but still accepts ordinary authorization URLs has added a safer route without closing the old one. Anyone can still write an ordinary URL naming the printer, with whatever parameters the registration allows. The protections apply only to requests that take the new route.

Closing the old route is a policy setting, and it can be announced in metadata, the JSON document where the service lists its endpoints and features. For the whole service, the setting appears in the authorization server's metadata. For one client, it can be recorded in that client's registration:

Authorization server metadata (excerpt):
{
  "issuer": "https://auth.photos.example",
  "authorization_endpoint": "https://auth.photos.example/authorize",
  "pushed_authorization_request_endpoint": "https://auth.photos.example/par",
  "require_pushed_authorization_requests": false
}

Client registration for photo-printer (excerpt):
{
  "require_pushed_authorization_requests": true
}

Here the photo service does not require PAR from every client, but it does from the printer. Any authorization request for photo-printer that lacks a request URI obtained from the PAR endpoint is refused with invalid_request. Both settings default to false when omitted.

PAR can also change how return addresses are handled. Exact matching against the registered list remains the normal rule. Because the service authenticates the client before the authorization begins, the specification allows a service to relax that rule for clients with credentials, accepting a return address the client supplies in the push without registering it first. A client could then use a distinct address for each authorization server it works with, chosen at run time. The service decides whether to allow this and can still limit it, for example by requiring every such address to start with https://printer.example/oauth/.

That freedom must never extend to unauthenticated pushes. If anyone could push a request with a return address of their choosing, the photo service would send people and their codes wherever an attacker liked. A public client, which cannot authenticate, keeps to its registered addresses.

Check your understanding

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

A request URI from Ava's connection turns up in a proxy log an hour later, and someone opens the authorization endpoint with it. What stops them? 1 of 4

Choose one answer.

The photo service supports PAR but still accepts ordinary authorization URLs for the printer. What can an attacker still do? 2 of 4

Choose one answer.

A developer changes the printer's callback path in its code but not in its registration, and the next push comes back 400 invalid_request. What should the printer do? 3 of 4

Choose one answer.

An attacker pushes a request under their own registered client, naming their own return address, then sends Ava a link carrying that request URI with client_id=photo-printer. What happens when she opens it? 4 of 4

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