Skip to content

Pushed authorization request (PAR) builder

Build a pushed authorization request (RFC 9126) and the short authorization URL that follows it.

Runs in your browser. Nothing you paste is sent to us.

Request

The base URL, without /realms/…. Add a path if your server has one, such as /auth on old versions.

A sample value is filled in. Whatever you type stays in this page.

Paste the request_uri the server returned. A placeholder is filled in.

Two steps

1. Push the request from your back end

curl command
curl 'https://auth.example.com/realms/acme/protocol/openid-connect/ext/par/request' \
  -H 'Authorization: Basic d2ViLWFwcDpzYW1wbGUtc2VjcmV0LW5vdC1yZWFs' \
  --data-urlencode 'response_type=code' \
  --data-urlencode 'client_id=web-app' \
  --data-urlencode 'redirect_uri=https://app.example.com/callback' \
  --data-urlencode 'scope=openid profile email' \
  --data-urlencode 'code_challenge_method=S256'
Sample response (made-up values, HTTP 201)
{
  "request_uri": "urn:ietf:params:oauth:request_uri:SAMPLE-not-a-real-reference",
  "expires_in": 60
}

2. Send the browser to the authorization endpoint

Authorization URL
https://auth.example.com/realms/acme/protocol/openid-connect/auth?client_id=web-app&request_uri=urn%3Aietf%3Aparams%3Aoauth%3Arequest_uri%3ASAMPLE-not-a-real-reference

Only client_id and request_uri travel through the browser. Use the request_uri once, before expires_in runs out.

Keep for the token request: code_verifier
 
In Keycloak
A client can be made to accept only pushed requests with Pushed authorization request required, in the client’s advanced settings.

How to use it

  1. Enter your Keycloak server URL and realm, or custom endpoints.
  2. Enter the client credentials, redirect URI and scopes; state, nonce and PKCE are made for you.
  3. Send the push request from your back end and read request_uri from the response.
  4. Paste request_uri to get the authorization URL for the browser.

What to know

With PAR the client posts the authorization parameters straight to the server, authenticated, and gets back a request_uri. The browser then carries only client_id and request_uri.

That keeps the parameters away from the browser, where they could be read or changed, and the server checks them before the user sees a page.

In Keycloak the endpoint is https://<host>/realms/<realm>/protocol/openid-connect/ext/par/request. A client can be made to require it with Pushed authorization request required in its advanced settings.

What a pushed authorization request is

In the classic authorization code flow, every parameter of the request travels through the browser in the URL: client id, redirect URI, scopes, state, PKCE challenge and more. The browser, its extensions and anything that logs URLs can read and change them.

Pushed authorization requests, or PAR, are defined in RFC 9126. The client first sends the parameters straight to the authorization server in a back-channel POST. The server stores them and returns a short reference, the request_uri. The browser then carries only client_id and request_uri.

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

  1. The back end POSTs the authorization parameters to the PAR endpoint, authenticated as the client.
  2. The server answers 201 Created with request_uri and expires_in.
  3. The app redirects the browser to the authorization endpoint with client_id and request_uri only.
  4. The user signs in. The flow continues exactly like the code flow: callback with a code, then a token request.
Sample push request (made-up values)
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=S256
Sample response
HTTP/1.1 201 Created
Content-Type: application/json

{ "request_uri": "urn:ietf:params:oauth:request_uri:SAMPLE", "expires_in": 60 }
Sample browser redirect
https://auth.example.com/realms/acme/protocol/openid-connect/auth
  ?client_id=web-app
  &request_uri=urn%3Aietf%3Aparams%3Aoauth%3Arequest_uri%3ASAMPLE

The 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 requestPushed request
Parameters travelIn the browser URLIn a back-channel POST
Client authenticated before sign-inNoYes, for confidential clients
Parameters can be changed by the browserYesNo
Bad parameters reportedOn a page or callbackIn the push response
Extra round tripNoOne 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, nonce and 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_uri you 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

  1. Enter your Keycloak server URL and realm, or switch to custom URLs.
  2. Choose the client authentication and enter the client id and secret.
  3. Check the redirect_uri and scope.
  4. Copy the curl command and run it. Note request_uri and expires_in from the response.
  5. Paste request_uri into the field. Open the authorization URL before it expires.
  6. 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.

  1. Run the curl command in a terminal.
  2. Copy request_uri from the JSON response.
  3. Paste it into the tool and open the authorization URL straight away.
  4. 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

ErrorCauseFix
invalid_client (401)Wrong secret, wrong method, or unknown clientCheck the client authentication settings and credentials
invalid_request on pushA missing or repeated parameter, or the body sent as JSONSend form-encoded parameters, each once
invalid_request_uri on redirectThe request_uri expired or was already usedPush again and redirect at once
Rejected without PARThe client requires pushed requestsPush 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_uri once and promptly. RFC 9126 recommends a short lifetime.
  • Keep checking state, and iss when 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.
Questions

Frequently asked questions

What is the PAR endpoint in Keycloak?

https://<host>/realms/<realm>/protocol/openid-connect/ext/par/request. The realm’s discovery document lists it as pushed_authorization_request_endpoint.

How long is a request_uri valid?

For expires_in seconds from the push response. RFC 9126 recommends a short lifetime, and servers set their own. Redirect the browser right after pushing.

Can I reuse a request_uri?

No. Treat it as single-use. Push a new request for each sign-in attempt.

Do I still need PKCE with PAR?

Yes. PAR keeps the request away from the browser, but the code still comes back through the browser. PKCE makes a stolen code useless.

Why does the push return 201 and not 200?

RFC 9126 specifies 201 Created, because the server creates a new stored request. Clients should accept it as success.

How do I make Keycloak require PAR for a client?

Turn on Pushed authorization request required in the client’s advanced settings. Authorization requests from that client must then use a request_uri from the PAR endpoint.

Can a public client use PAR?

Yes. It sends client_id without a secret. It gains the shorter URL and hidden parameters, but not the assurance that comes from client authentication.

Does PAR replace the authorization endpoint?

No. The user still goes to the authorization endpoint to sign in. PAR only changes how the parameters get there: by reference instead of in the URL.

Which parameters go in the push and which in the URL?

Everything that would normally be in the authorization URL goes in the push, including client_id. The browser URL then carries only client_id and the request_uri from the response.

Is PAR the same as a request object?

No. A request object is a signed JWT holding the parameters, sent by value in the request parameter or by reference. PAR stores the parameters at the server and hands back a reference. They can be combined: a request object can be pushed.

Rather not run Keycloak yourself?

We run it for you on a cluster of your own, with backups, upgrades and written support. Starter and Premium begin with a 7-day trial.