DevTools Logo

OAuth 2.0 PKCE & Authorization URL Builder

OAuth 2.0 PKCE & Authorization URL Builder

Build the authorize URL with state, scopes and a fresh S256 PKCE pair — locally, without issuing tokens.

Runs in your browser
Preset
Try an example

Authorization configuration

3 scopes · S256

The authorize request is public — never put a client secret here. No value is sent anywhere.

Authorization endpoint must be an absolute http(s) URL (RFC 6749 §3.1).

client_id is required.

openidprofileemail

Authorization URL

Not ready

Add an authorization endpoint and client ID

Pick a provider preset or load an example. The PKCE pair is already generated.

PKCE session & request details

generating…

Token request snippet (display only)

curl -X POST 'https://provider.example/token' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=authorization_code&code=AUTHORIZATION_CODE&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fcallback&client_id=YOUR_CLIENT_ID&code_verifier=CODE_VERIFIER'

The verifier is reused here at the token endpoint. This tool never sends the request; a client secret must stay on a server.

Details

Configure the front half of an OAuth 2.0 / OpenID Connect authorization-code flow: endpoint, client ID, redirect URI, scopes, response type and the parameters providers are picky about — state, nonce, prompt, display, max_age and login_hint. The tool generates a 43-character code_verifier from 32 cryptographic random bytes, derives the unpadded base64url S256 code_challenge with SHA-256, and also creates fresh state and nonce values. The authorize URL is assembled live with RFC 6749 percent-encoding (scopes use %20, never '+'), preserving any query parameters already on a custom endpoint. A decoded parameter table and a baseline diff make it easy to see what changed between test runs. Redirect URIs with fragments and insecure non-loopback http endpoints are rejected with the relevant RFC reason; native-app custom schemes and all loopback forms are accepted. Regenerating replaces the whole PKCE pair and shows a supersession warning so a stale verifier is not reused at token exchange. Export/import of a JSON test fixture is explicit, never automatic: no verifier, challenge or state is stored in localStorage. This tool never calls a token endpoint and has no client-secret field — the authorize request is public data by design.

More examples

Localhost authorization-code flow

endpoint: https://accounts.google.com/o/oauth2/v2/auth
client_id: example-client
redirect_uri: http://localhost:3000/callback
scope: openid profile email

The generated URL adds state, code_challenge and code_challenge_method=S256 automatically, with scopes encoded as %20.

RFC 7636 Appendix B vector

code_verifier: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
code_challenge: E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM

S256 is base64url(SHA-256(verifier)) with no padding, so the standard test vector can be used to verify the derivation.

Native app redirect

redirect_uri: com.example.app:/oauth2redirect

RFC 8252 private-use custom schemes are accepted for native clients; http is allowed only on loopback hosts.

Rejected fragment redirect

redirect_uri: https://app.example.com/callback#section → RFC 6749 §3.1.2: redirect_uri must not contain a fragment.

The builder explains why the redirect is invalid instead of silently producing a URL a provider will reject.

Examples

Minimal local development request

Input
endpoint: https://accounts.google.com/o/oauth2/v2/auth
client_id: example-client
redirect_uri: http://localhost:3000/callback
scope: openid profile email
Output
…/auth?response_type=code&client_id=example-client&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fcallback&scope=openid%20profile%20email&state=…&code_challenge=…&code_challenge_method=S256

Scopes use %20 and every reserved character in the redirect URI is percent-encoded.

RFC 7636 Appendix B vector

Input
code_verifier: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
Output
code_challenge: E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM

The published test vector proves the S256 derivation is unpadded base64url of the SHA-256 digest.

Native app redirect

Input
redirect_uri: com.example.app:/oauth2redirect
Output
Accepted — RFC 8252 private-use custom scheme

A browser app uses loopback http; a native app registers a custom scheme instead. The tool allows both.

Rejected fragment

Input
redirect_uri: https://app.example.com/callback#section
Output
RFC 6749 §3.1.2: redirect_uri must not contain a fragment.

The authorization response would place parameters after the fragment, so the request is rejected before it is built.

About this tool

This tool builds the browser redirect that starts an OAuth 2.0 or OpenID Connect authorization-code flow. Enter the provider's authorization endpoint, your public client ID, the registered redirect URI and the scopes you need; the page assembles a correctly encoded authorize URL as you type. State, nonce, code_challenge and code_challenge_method are generated and appended so the request is complete rather than a scaffold you have to finish by hand.

PKCE (Proof Key for Code Exchange, RFC 7636) protects public clients against code interception. The tool creates a 43-character code_verifier from 32 bytes of cryptographic randomness, derives code_challenge = base64url(SHA-256(verifier)) without padding, and keeps the verifier visible for reuse at the token endpoint. You can lengthen the verifier to 86 or 128 characters if your organisation requires it. The deprecated plain method is available as a clearly flagged fallback; S256 is the default.

Encoding is deliberately strict. Scope tokens are separated by spaces and encoded as %20, not the '+' that URLSearchParams would produce; parameters already present on a custom endpoint are preserved, and managed parameters are replaced rather than duplicated. Redirect URIs containing a fragment are rejected with the RFC 6749 reason, as are http endpoints on non-loopback hosts. All loopback forms (localhost, 127.0.0.0/8 and [::1]) and RFC 8252 native-app custom schemes are accepted.

Regenerating replaces the verifier, challenge, state and nonce together and raises a supersession warning, because a verifier copied before regeneration is stale. A decoded parameter table, a baseline diff, provider presets and an explicit JSON fixture export make repeated hand-testing less error-prone. Nothing is transmitted or persisted by default: the randomness and hashing happen in this tab using WebCrypto, and the exported fixture is clearly labelled as test data, not a place for production secrets.

What this tool does not do

  • This tool builds the browser redirect only. It never calls a token endpoint and never exchanges an authorization code.
  • No client secret can be entered: public authorize requests must not contain one, and secrets must stay server-side.
  • Provider presets are editable templates, not live discovery; verify the endpoint and registered redirect URI against your provider's documentation.
  • The plain challenge method exists for compatibility and is deprecated; S256 is recommended and is the default.
  • Nothing is persisted by default. A reload creates a new pair, and the JSON fixture export is an explicit user action for test data only.
  • Pushed authorization requests (PAR/JAR), device flows and local redirect capture are not implemented.
  • Response types, prompt, display and custom parameters are validated for shape and allowed values, but the tool cannot know what an individual provider will accept.

How to use this tool

  1. Pick a provider or paste an endpoint

    Click an Auth0, Keycloak, Entra ID or Google preset, or paste an authorize URL. Known provider hosts are detected and their template and default scopes are applied; every field stays editable.

  2. Fill in the client and redirect

    Enter the public client ID and the redirect URI registered with the provider. Use http://localhost:PORT/callback for local testing; fragments are rejected, native custom schemes are allowed.

  3. Add scopes and extras

    Type a scope and press Enter to add a chip. Set response_type (code by default), and optionally state, nonce, prompt, display, max_age, login_hint and custom key=value parameters.

  4. Copy the PKCE pair before regenerating

    Copy the code verifier immediately — the token exchange needs it later. Regenerating issues a fresh verifier/challenge/state/nonce and flags the old pair as superseded.

  5. Use the URL and inspect the request

    Copy the complete authorize URL or open it in a new tab to start the login. Expand the decoded parameter table to check values, or set a baseline to see which parameters changed on later edits.

Use cases

Wire up a first OIDC login

Produce a valid authorize URL for Auth0, Keycloak, Entra or Google without copying a curl snippet out of provider documentation.

Hand-test a mobile PKCE flow

Generate a verifier/challenge pair for a native app with an RFC 8252 custom-scheme redirect and a 128-character verifier if required.

Replay an authorize request with changed scopes

Use the baseline diff to confirm exactly which parameter changed when adding consent, display or a custom provider parameter.

Build regression fixtures

Export the configuration and current pair as JSON for a local test fixture, explicitly without production secrets.

Generated authorize request parameters

ParameterHow this tool emits it
response_typeYour choice, code by default; free-form so hybrid values such as code id_token work. token triggers a deprecation warning.
client_idPublic client ID, UTF-8 percent-encoded verbatim; there is deliberately no client-secret field.
redirect_uriRegistered callback. Must be absolute and fragment-free; http is limited to loopback hosts, custom schemes are accepted.
scopeSpace-delimited chips encoded with %20 for the space, per RFC 6749 Appendix B.
state16 random bytes as unpadded base64url, or your explicit override; also regenerated on each new pair.
nonceGenerated with the pair for id_token response types, or supplied as an override; required when id_token is requested.
code_challenge / code_challenge_methodbase64url(SHA-256(verifier)) with no '=' padding, followed by S256 (or explicitly flagged plain).
Extrasprompt, display, max_age, login_hint and provider-specific key=value lines, appended after the standard parameters.

Existing query parameters on a custom endpoint are preserved; managed parameters are never emitted twice.

Common mistakes

Mistake:Sending the code_verifier in the authorize URL instead of the code_challenge.

Fix:The URL carries only the challenge. Keep the verifier for the token request; the display-only curl snippet shows where it belongs.

Mistake:Reusing a verifier after regenerating the URL or refreshing the page.

Fix:Regeneration replaces verifier, challenge, state and nonce together and shows a supersession banner. Copy the current pair again.

Mistake:Padding the base64url challenge with '=' or using URLSearchParams for scopes.

Fix:RFC 7636 requires unpadded base64url and RFC 6749 encodes the scope space as %20. This tool applies both encodings for you.

Mistake:Omitting state (or nonce for id_token responses).

Fix:State and nonce are generated automatically. Leave the override fields blank unless you need to replay a known value, and never omit them from your server-side session checks.

Mistake:Registering a redirect URI with a #fragment or using plain http outside loopback.

Fix:Fragments are forbidden by RFC 6749 §3.1.2 and http is restricted to loopback hosts. Register the exact http(s) or custom-scheme URI shown in the tool.

Mistake:Pasting a client secret into a public authorize request.

Fix:There is no secret field for a reason. Client secrets belong on the token endpoint, which this tool deliberately does not call.

Frequently asked questions

What is PKCE and why do I need it?

PKCE (RFC 7636) protects the authorization-code flow for public clients such as single-page and mobile apps, which cannot keep a client secret. The client creates a random code_verifier, sends only its SHA-256 hash (the code_challenge) in the authorize request, and proves possession of the verifier at the token endpoint. An attacker who intercepts the authorization code cannot exchange it without the original verifier. This tool builds that authorize request; it does not perform the exchange.

How long must a code_verifier be?

RFC 7636 §4.1 requires 43 to 128 characters from the unreserved set A–Z, a–z, 0–9, '-', '.', '_' and '~'. The default here is 43 characters derived from 32 random bytes. Use the length control to generate 86 or 128 characters when an organisation or provider standard requires a longer verifier; the challenge derivation is identical.

Does the code_challenge need base64 padding?

No. S256 is defined as base64url(SHA-256(ASCII(verifier))) using RFC 4648 §5's URL-safe alphabet with trailing '=' padding removed. A 32-byte digest is exactly 43 unpadded characters. Adding '=' or using standard base64 with '+' and '/' gives a challenge a conforming provider will reject; the built-in RFC test vector checks the exact encoding.

What is state for, and why is it generated here?

The state parameter binds the authorization response to the browser session so a forged callback can be detected (RFC 6749 §10.12). This tool generates 16 random bytes as base64url and includes the value in the URL; you must store it in your session and compare it with the state returned by the provider. Leave the override blank unless you are deliberately replaying a known value. Regenerating also refreshes state, so update any saved copy.

Can I use http://localhost as redirect_uri?

Yes. Loopback redirects are the standard development pattern: localhost, any 127.0.0.0/8 address and [::1] may use http (RFC 8252 §7.3). Non-loopback http redirects are rejected. Native apps can instead register a private-use custom scheme such as com.example.app:/callback, which this tool also accepts. The redirect must match the URI registered with the provider exactly and must never contain a fragment.

Why does an id_token response require a nonce?

OpenID Connect Core §3.1.3.1 requires a nonce whenever an ID token is returned from the authorization endpoint (for example response_type=code id_token or id_token). The client stores it and checks that the same value appears in the ID token claims, preventing replay. This tool generates a nonce with the PKCE pair when you request such a response type, and reports an inline error if you choose that response type with the nonce override empty.

Does this tool exchange the authorization code or store my verifier?

No to both. Nothing is sent over the network: the URL is assembled in your browser tab and the token-request snippet is display-only guidance showing where the verifier goes. No verifier, challenge, state or nonce is written to localStorage. The optional JSON export is an explicit download intended for local test fixtures and must never contain production secrets.

What happens when I click Regenerate?

A fresh verifier, challenge, state and nonce are generated together, and a supersession banner reminds you that the previous values are no longer valid. The classic failure mode is copying a verifier early, regenerating the URL and then presenting the stale verifier at token exchange — copying the current value again fixes it.

Should I use the plain challenge method?

Only when a legacy provider leaves no choice. With plain, the verifier itself is sent as code_challenge, so it is exposed in the authorize URL and browser history. S256 sends only a one-way hash and is the default; enabling plain shows a warning on every result.

Why are scopes encoded as %20 instead of '+'?

RFC 6749 Appendix B defines the scope parameter as a space-delimited, percent-encoded list, and strict providers expect %20. URLSearchParams serialises spaces as '+', which is form encoding and is not equivalent here. This builder uses encodeURIComponent for every parameter, so a scope list such as openid profile becomes openid%20profile.

References & standards