What the callback URL is
After the user signs in, the authorization server sends the browser back to the app’s redirect_uri. The parameters on that redirect are the authorization response. This is the callback URL, and it is the point where the sign-in either succeeded or failed.
RFC 6749 section 4.1.2 defines a successful response: a code and the state the app sent. Section 4.1.2.1 defines the error response: error, an optional error_description and error_uri, and again state. OpenID Connect and later RFCs add a few more parameters, such as iss from RFC 9207.
Examples of what comes back
https://app.example.com/callback
?state=Zq3v8sample7KpW2
&session_state=5f1c2d3e-sample
&iss=https%3A%2F%2Fauth.example.com%2Frealms%2Facme
&code=SAMPLE-CODE.not-a-real-codehttps://app.example.com/callback
?error=login_required
&error_description=Login+required
&state=Zq3v8sample7KpW2Which one you get depends on what happened at the server, not on the app. Both carry state, so the app can match either to the request that started it.
The code is an opaque string. Its format is up to the server, so never parse it or rely on its length.
The parameters you may see
| Parameter | Meaning |
|---|---|
code | The authorization code; exchange it once, right away |
state | Must equal the value the app stored before the redirect |
iss | The issuer that sent the response (RFC 9207) |
session_state | Keycloak’s id for the user’s session at the server |
error | An error code such as access_denied or login_required |
error_description | Human-readable detail about the error |
access_token, id_token | Tokens in the URL: the implicit or hybrid flow |
What this tool does
- Reads the query and the #fragment of the URL you paste, in your browser.
- Lists every parameter with its decoded value and meaning.
- Compares
statewith the value you expect. - Compares
isswith the issuer you expect. - Explains a standard error code and links to the full lookup.
- Warns about tokens in the URL and repeated parameters.
Two sample buttons fill in a successful and a failed callback, so you can see both before using your own.
What it does not do
It does not exchange the code for tokens and does not contact the server. A code is useless after one use, and pasting it here does not use it. To redeem it, build the request with the token request builder.
How to use the parser
- Sign in through your app or a URL from the authorization URL builder.
- Copy the full address the browser landed on, including anything after
?or#. - Paste it. Enter the state your app stored, and your issuer, if you want them checked.
- Read the notes. A green note means a code came back and state matched.
- Exchange the code within its short lifetime, with the same
redirect_uriand your PKCE verifier.
If your app redirects again as soon as the callback loads, the URL disappears from the address bar. Open the developer tools with Preserve log turned on, and copy it from the Network tab.
What to check on every callback
state
Compare state with the value stored for this browser session before doing anything else. If it is missing or different, drop the response. It may be a forged callback, an old tab or a session that expired.
iss
If the server sends iss, compare it with your expected issuer. RFC 9207 added it to stop mix-up attacks, where a client that talks to several authorization servers is tricked into sending a code to the wrong one. For Keycloak, the issuer is https://<host>/realms/<realm>.
error
An error parameter means no code. Show a helpful message, log the code and description, and offer to sign in again. Never show error_description as trusted HTML; it is text from a URL anyone can craft.
Response modes: query, fragment and form_post
Where the parameters appear depends on response_mode. With query, the default for the code flow, they are after ?. With fragment they are after #, which only the browser sees; a server never receives the fragment. With form_post, defined by the OAuth 2.0 Form Post Response Mode specification, the server posts them as a form to the redirect URI, so they never appear in the address bar at all.
The parser reads both query and fragment. A form post has no URL to paste; read the request body in the Network tab instead.
Where callbacks land in different apps
Server-side web apps
The callback is a route on your back end, such as /callback. It checks state against the server session, exchanges the code with the client secret and PKCE verifier, and then redirects the browser to a clean page. The code never needs to reach browser code.
Single-page apps
The callback is a page of the app itself. Browser code reads the query, checks state from session storage, and posts the code with the verifier to the token endpoint. Replace the URL with history.replaceState afterwards so the code does not stay in history.
Mobile and desktop apps
The callback is a claimed https link, a private URI scheme such as com.example.app:/callback, or a loopback address like http://127.0.0.1:8123/callback, as RFC 8252 describes. To debug one, copy the URL the system browser tried to open, often visible in its history or the app’s logs.
How Keycloak builds the callback
On success Keycloak redirects with state, session_state, code and, by default, iss. On an error it sends error, error_description and state.
Some failures never reach your callback. If the redirect_uri does not match the client’s Valid redirect URIs, Keycloak shows Invalid parameter: redirect_uri on its own page, because it will not redirect to an untrusted address. If the client does not exist, it shows a Client not found page.
Keycloak’s authorization codes are short-lived and single-use. If the token request comes too late or twice, it fails with invalid_grant and the description Code not valid.
Common errors on the callback
| error | Usual cause | What to do |
|---|---|---|
access_denied | The user declined, or a policy blocked them | Explain and offer to try again |
login_required | A prompt=none request found no session | Start a normal sign-in |
consent_required | A silent request needs consent first | Start a sign-in without prompt=none |
invalid_scope | A scope that is not available to the client | Fix the scope list |
unauthorized_client | The flow is turned off for the client | Turn on Standard flow |
temporarily_unavailable | The server is overloaded or in maintenance | Retry later |
Every standard code is explained in the OAuth error lookup.
Security notes
- Check
state, andisswhen present, before using the code. - Exchange the code once and quickly. Never log full codes or store them.
- Tokens in the URL mean the implicit flow. RFC 9700 says not to use it; move to the code flow with PKCE.
- Clear the code from the address bar after handling it, for example by redirecting to a clean page.
- Do not paste live codes into shared tickets or chats. A code plus the verifier is enough to get tokens until it expires.