Why PAR exists
- Integrity: the parameters cannot be changed in the browser, because the browser never sees them.
- Confidentiality: scopes, hints and other details stay off the address bar and out of logs.
- Client authentication: a confidential client authenticates when it pushes, so the server knows the request really came from it before the user sees a page.
- Early errors: the server checks the parameters, such as the redirect URI, at push time and can answer with a normal error response instead of an error page.
- Short URLs: long requests, such as ones with
authorization_details, no longer hit URL length limits.
PAR is part of the FAPI 2.0 security profile used in open banking and other high-assurance setups. It is also a good default for any confidential client.
How PAR works, with an example
- The back end POSTs the authorization parameters to the PAR endpoint, authenticated as the client.
- The server answers 201 Created with
request_uriandexpires_in. - The app redirects the browser to the authorization endpoint with
client_idandrequest_urionly. - The user signs in. The flow continues exactly like the code flow: callback with a code, then a token request.
POST /realms/acme/protocol/openid-connect/ext/par/request HTTP/1.1
Host: auth.example.com
Content-Type: application/x-www-form-urlencoded
Authorization: Basic d2ViLWFwcDpzYW1wbGUtc2VjcmV0LW5vdC1yZWFs
response_type=code&client_id=web-app
&redirect_uri=https%3A%2F%2Fapp.example.com%2Fcallback
&scope=openid+profile&state=Zq3v8sample7KpW2
&code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
&code_challenge_method=S256HTTP/1.1 201 Created
Content-Type: application/json
{ "request_uri": "urn:ietf:params:oauth:request_uri:SAMPLE", "expires_in": 60 }https://auth.example.com/realms/acme/protocol/openid-connect/auth
?client_id=web-app
&request_uri=urn%3Aietf%3Aparams%3Aoauth%3Arequest_uri%3ASAMPLEThe body above is wrapped for reading. On the wire it is one line. The request_uri is an opaque value chosen by the server; do not build or parse it yourself.
PAR compared with a classic request
| Classic request | Pushed request | |
|---|---|---|
| Parameters travel | In the browser URL | In a back-channel POST |
| Client authenticated before sign-in | No | Yes, for confidential clients |
| Parameters can be changed by the browser | Yes | No |
| Bad parameters reported | On a page or callback | In the push response |
| Extra round trip | No | One POST before the redirect |
The cost is one extra request from your back end per sign-in. Check whether your OpenID Connect library supports PAR; where it does, it is usually a setting rather than new code.
What this tool does
- Builds Keycloak’s PAR and authorization endpoints from a server URL and realm, or takes custom URLs.
- Makes
state,nonceand a PKCE verifier in your browser and computes the S256 challenge. - Adds client authentication: Basic header, secret in the body, a signed JWT, or none for public clients.
- Shows the push request as a curl command or a raw HTTP request.
- Builds the short authorization URL from the
request_uriyou paste. - Shows the code verifier to keep for the token request.
What it does not do
It does not send the push request. Run the curl command from a machine that can reach your server; PAR is meant to come from a back end, and browsers usually cannot call it across origins anyway. The request_uri field starts with a placeholder until you paste the real one.
How to use the builder
- Enter your Keycloak server URL and realm, or switch to custom URLs.
- Choose the client authentication and enter the client id and secret.
- Check the
redirect_uriandscope. - Copy the curl command and run it. Note
request_uriandexpires_infrom the response. - Paste
request_uriinto the field. Open the authorization URL before it expires. - After sign-in, exchange the code with the token request builder, using the verifier shown here.
Testing PAR by hand
Because the request_uri expires quickly, testing by hand is a race. Prepare everything first: open the authorization URL field, have the curl command ready, and keep a browser tab waiting.
- Run the curl command in a terminal.
- Copy
request_urifrom the JSON response. - Paste it into the tool and open the authorization URL straight away.
- If you see
invalid_request_uri, it expired. Push again.
If the push itself fails, read the JSON error. It often names the parameter at fault, which is easier to debug than an error page after a redirect.
How Keycloak handles PAR
Keycloak’s PAR endpoint is https://<host>/realms/<realm>/protocol/openid-connect/ext/par/request. It is listed in the realm’s discovery document as pushed_authorization_request_endpoint.
Any OpenID Connect client can use PAR. A client can also be made to accept only pushed requests with Pushed authorization request required, in its advanced settings. Requests from that client that skip PAR are then rejected.
RFC 9126 requires the server to validate pushed parameters just as it would a normal authorization request. Problems such as a redirect URI that is not registered can then be reported to your back end at push time, as a JSON error, instead of on an error page in the user’s browser.
Use cases
Server-side web apps
The best fit. The back end already holds a client secret or key, so it can authenticate the push. The browser only sees a short reference.
High-assurance and regulated setups
FAPI 2.0 requires PAR. Banking, health and government integrations often require it together with PKCE and sender-constrained tokens.
Large or sensitive requests
Requests with authorization_details (RFC 9396) or many scopes can grow past what some browsers, proxies and servers accept in a URL. Pushing them avoids the limit.
Public clients
A single-page or mobile app can push too, sending only client_id. It still keeps the parameters out of the URL, but without client authentication the main benefit is smaller.
Common errors and fixes
| Error | Cause | Fix |
|---|---|---|
invalid_client (401) | Wrong secret, wrong method, or unknown client | Check the client authentication settings and credentials |
invalid_request on push | A missing or repeated parameter, or the body sent as JSON | Send form-encoded parameters, each once |
invalid_request_uri on redirect | The request_uri expired or was already used | Push again and redirect at once |
| Rejected without PAR | The client requires pushed requests | Push first, or turn the requirement off |
For other codes, see the OAuth error lookup.
Security notes
- Push from the back end, over https, with real client authentication. A signed JWT (
private_key_jwt) avoids sending a shared secret. - Keep PKCE. PAR protects the request; PKCE protects the code.
- Use each
request_urionce and promptly. RFC 9126 recommends a short lifetime. - Keep checking
state, andisswhen present, on the callback, as with any code flow. - Require PAR on clients that support it, so an attacker cannot fall back to a plain request.
Best practices
- Read the PAR endpoint from the discovery document instead of hard-coding it.
- Push and redirect in the same request handler, so the reference is fresh.
- Log the push error response; it is the most precise clue when sign-in breaks.
- Keep the same
state, nonce and verifier handling you use without PAR. - Test the require-PAR setting in a staging realm before turning it on in production, so older clients are not locked out.