The parameters, one by one
| Parameter | Required | What it does |
|---|---|---|
response_type | Yes | code for the authorization code flow |
client_id | Yes | The client’s id at the server |
redirect_uri | Yes in OpenID Connect | Where the browser comes back; must match a registered value |
scope | Yes in OpenID Connect | Space-separated; openid turns on OpenID Connect |
state | Recommended | Random value checked on the callback |
nonce | Recommended for code flow | Random value copied into the ID token |
code_challenge | Recommended | PKCE hash of the code verifier |
code_challenge_method | With PKCE | S256 |
response_mode | No | query, fragment or form_post |
prompt | No | none, login, consent or select_account |
login_hint | No | Prefills the username on the sign-in page |
Servers may define their own parameters too. Keycloak reads kc_idp_hint, for example, which is covered below.
An example request and response
https://auth.example.com/realms/acme/protocol/openid-connect/auth
?response_type=code
&client_id=web-app
&redirect_uri=https%3A%2F%2Fapp.example.com%2Fcallback
&scope=openid%20profile%20email
&state=Zq3v8sample7KpW2
&nonce=n0nceSample4xQ
&code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
&code_challenge_method=S256HTTP/1.1 302 Found
Location: https://app.example.com/callback?state=Zq3v8sample7KpW2&code=SAMPLE_CODEThe URL is shown on several lines for reading. In practice it is one line, and every value is percent-encoded.
What this tool does
- Builds Keycloak’s authorization endpoint from a server URL and a realm, or takes any custom endpoint.
- Makes a random
state,nonceand PKCE code verifier in your browser, and computes the S256 challenge. - Lets you set
response_type,scope,response_mode,prompt,login_hintandkc_idp_hint. - Accepts extra parameters as name=value lines, for anything the form does not cover.
- Percent-encodes every value and lists the parameters one per row.
- Warns about the implicit flow, missing PKCE, a missing
openidscope and plain http redirects. - Shows the code verifier you must keep for the token request.
The Open in a new tab button sends your browser to the URL, which is exactly what your app would do. Nothing passes through us.
What it does not do
It does not know your client’s registered redirect URIs, so it cannot tell whether the server will accept the one you typed. Check that with the redirect URI matcher. It also does not sign request objects or push the request to the server; for that, use the PAR request builder.
How to build a URL step by step
- Enter your Keycloak server URL, without
/realms/, and the realm name. Or switch to Custom URL and paste any authorization endpoint. - Enter the
client_idandredirect_uriexactly as registered on the client. - Keep
response_typeoncodeand PKCE turned on. - Edit the scopes. Keep
openidif you want an ID token. - Set
prompt,login_hintorkc_idp_hintif your test needs them. - Copy the URL or open it. Copy the code verifier too.
- After sign-in, read the callback with the callback URL parser, then exchange the code with the token request builder.
Encoding the URL correctly
Each parameter value must be percent-encoded, because it sits inside a URL. The redirect URI is the value that most often goes wrong, since it is itself a URL full of : and / characters.
- Spaces between scopes become
%20. Many servers also accept+in the query, but%20is unambiguous. - Encode each value once. Double encoding turns
%2Finto%252Fand the server sees a different redirect URI. - Do not encode the
=and&that separate parameters. - Do not worry about order. Servers read parameters by name.
- Send each parameter only once. A repeated parameter makes the request invalid.
Libraries such as URLSearchParams in the browser handle this for you. The tool uses the same rules, so its output is a good reference when your own URL looks different.
Choosing the response type
Use response_type=code. The server returns a short-lived code in the redirect, and the app trades it for tokens over a direct back-channel request.
The tool also offers token and id_token token, the implicit flow, so you can debug old setups. The implicit flow returns tokens in the URL fragment, where they can leak through browser history, logs and referrer headers. It also cannot use PKCE or sender-constrained tokens. RFC 9700 says clients should not use it. A single-page app should use the code flow with PKCE instead.
Use cases
Testing a new client
Before wiring up a library, build the URL by hand and sign in once. If it works here, the realm and client are set up correctly and any remaining problem is in the app.
Single-page and mobile apps
Public clients rely on PKCE. Build a request with the challenge, then make sure your app sends the matching verifier. RFC 8252 asks mobile and desktop apps to open this URL in the system browser, not an embedded web view.
Forcing a fresh sign-in or a silent check
prompt=login makes the user enter credentials again even with a session. prompt=none asks for a result with no page at all and fails with login_required if there is no session. max_age limits how old the last sign-in may be.
Sending users to one identity provider
When a realm has several identity providers, kc_idp_hint skips Keycloak’s own sign-in page and goes straight to the provider with that alias.
How Keycloak handles the request
Keycloak’s authorization endpoint is https://<host>/realms/<realm>/protocol/openid-connect/auth. Every realm has its own. Servers on very old versions, or set up with a path, have it under that path, such as /auth/realms/<realm>/....
Keycloak checks the client_id and the redirect_uri first. If the redirect URI does not match one of the client’s Valid redirect URIs, it shows an error page with Invalid parameter: redirect_uri instead of redirecting. That is deliberate: it will not send a result to an address it does not trust.
The client must have Standard flow turned on for response_type=code. A client can also be set to require PKCE with S256, in which case requests without a challenge fail.
Common errors and how to fix them
| What you see | Cause | Fix |
|---|---|---|
Invalid parameter: redirect_uri | The URI does not match a registered one | Register the exact URI, or test it with the redirect URI matcher |
| Client not found | Wrong client_id, or the wrong realm | Check both; ids are case-sensitive |
unauthorized_client | The flow is turned off for the client | Use code and turn on Standard flow |
invalid_scope | A scope that is not assigned to the client | Add it as a client scope, or remove it |
login_required | prompt=none and no session | Send the user through a normal sign-in |
Look up any other code in the OAuth error lookup.
Security notes
- Use the code flow with PKCE for every client, as RFC 9700 recommends.
- Register exact redirect URIs and use https outside localhost.
- Make
state,nonceand the verifier fresh for each request and keep them in the session. - Never put a client secret or a token in the authorization URL. It is visible to the browser.
- Treat
login_hintand other hints as untrusted input on the server side.