Skip to content

OAuth callback URL parser

Paste the URL your app was redirected to after sign-in and read the code, state, session_state, issuer or error.

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

Callback URL

A sample is filled in. Paste yours; it stays in your browser. A code is single-use and expires fast.

The state your app stored before the redirect.

Checked against iss (RFC 9207) when the server sends it.

What came back

An authorization code came back
Exchange it at the token endpoint now, with the same redirect_uri and your PKCE code_verifier. Build the token request.
state matches
This response belongs to the request your app started.
iss matches
The response comes from the expected issuer.
state
Zq3v8sample7KpW2Must equal the state your app sent. If not, drop the response.
session_state
5f1c2d3e-sampleKeycloak: the id of the user’s session at the server.
iss
https://auth.example.com/realms/acmeThe issuer that sent the response (RFC 9207). Check it equals your issuer.
code
SAMPLE-CODE.not-a-real-codeThe authorization code. Exchange it at the token endpoint once, soon.

How to use it

  1. Copy the full callback URL from the browser’s address bar or a network log.
  2. Paste it, and enter the state your app stored if you want it checked.
  3. Read the result: a code to exchange, or an error and what it means.

What to know

After sign-in the server redirects to your redirect_uri with code and state, or with error and error_description. Keycloak also adds session_state and, by default, iss (RFC 9207).

Always check that state equals the value you stored. If iss is present, check it equals your issuer; a different issuer can mean a mix-up attack.

Tokens in the URL mean the implicit flow. Switch to the code flow with PKCE.

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

Sample success (made-up values)
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-code
Sample error
https://app.example.com/callback
  ?error=login_required
  &error_description=Login+required
  &state=Zq3v8sample7KpW2

Which 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

ParameterMeaning
codeThe authorization code; exchange it once, right away
stateMust equal the value the app stored before the redirect
issThe issuer that sent the response (RFC 9207)
session_stateKeycloak’s id for the user’s session at the server
errorAn error code such as access_denied or login_required
error_descriptionHuman-readable detail about the error
access_token, id_tokenTokens 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 state with the value you expect.
  • Compares iss with 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

  1. Sign in through your app or a URL from the authorization URL builder.
  2. Copy the full address the browser landed on, including anything after ? or #.
  3. Paste it. Enter the state your app stored, and your issuer, if you want them checked.
  4. Read the notes. A green note means a code came back and state matched.
  5. Exchange the code within its short lifetime, with the same redirect_uri and 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

errorUsual causeWhat to do
access_deniedThe user declined, or a policy blocked themExplain and offer to try again
login_requiredA prompt=none request found no sessionStart a normal sign-in
consent_requiredA silent request needs consent firstStart a sign-in without prompt=none
invalid_scopeA scope that is not available to the clientFix the scope list
unauthorized_clientThe flow is turned off for the clientTurn on Standard flow
temporarily_unavailableThe server is overloaded or in maintenanceRetry later

Every standard code is explained in the OAuth error lookup.

Security notes

  • Check state, and iss when 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.
Questions

Frequently asked questions

What do I do with the code in the callback URL?

Send it to the token endpoint in a POST with grant_type=authorization_code, the same redirect_uri and your PKCE code_verifier. Do it right away, because codes expire quickly. The response holds the access token, and an ID token if you asked for openid.

What is session_state in a Keycloak callback?

It is Keycloak’s id for the user’s session at the server. Clients that monitor the session use it. It is not a secret and does not authenticate anything by itself.

Why is the iss parameter in my callback?

RFC 9207 lets the server name itself in the authorization response. It protects clients that use several authorization servers against mix-up attacks. Compare it with the issuer you expect.

Why are the parameters after a # instead of a ?

The response mode was fragment, set by response_mode=fragment or by the implicit flow. A server cannot read the fragment, so only browser code can handle that callback.

What does error=login_required mean?

The request used prompt=none and the user had no session at the server. The server could not sign them in silently. Send them through a normal sign-in.

Can I reuse an authorization code?

No. A code is single-use. A second exchange fails with invalid_grant, and servers may revoke tokens already issued from that code.

Is it safe to paste my callback URL here?

The URL is read in your browser and never sent to us. A code is short-lived and needs the PKCE verifier or client secret to be redeemed. Prefer test accounts and expired codes anyway.

Why does the callback page show an error but my logs show nothing?

If the response mode was fragment, the error sits after the # and never reaches your server. If Keycloak rejected the redirect_uri, it never redirected at all, and the error page you see is Keycloak’s own. Paste the address into the parser to tell which.

Why does my state not match?

Most often the app lost the stored value: the session cookie was blocked, expired or set for another domain. A second tab that started its own sign-in also overwrites it. Rarely, it is a forged callback, which is why the check matters.

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.