Start a project

Tool 184 of 194 · Security

OAuth 2.0 PKCE Flow Simulator

Debug an OAuth login: generate the PKCE values, build the authorisation URL, then paste where the browser landed to check it and get the token request.

OAuth 2.0 PKCE Flow Simulator

Client and server

Verifier, challenge and state

code_challenge
Authorisation URL

The callback and the token request

    #StepWhat happensCheck
    Token request
    As curl

    Nothing is sent anywhere: this page builds the requests for you to run. The verifier and state come from your browser's secure random generator.

    01

    What it does

    Makes a PKCE verifier and challenge with WebCrypto, builds the authorisation URL, checks the callback's state and errors, and writes the token request.

    • RFC 7636 code verifier and S256 or plain challenge, checked against the RFC's test vector
    • Authorisation URL with state, nonce and any extra parameters
    • Callback check: state, error codes explained, code in the fragment and the RFC 9207 iss parameter
    • Token request as raw HTTP and as curl

    02

    Private by design

    Everything happens in your browser. Nothing you type, paste or upload is sent anywhere, and it keeps working offline once the page has loaded.

    03

    What you get

    A challenge, authorisation URL, callback checks, token request and flow diagram, with a Copy and a Download button on every result.

    • OAuth 2.0
    • PKCE
    • OpenID Connect
    • Security

    Why it matters

    PKCE (Proof Key for Code Exchange) protects the OAuth authorisation code flow: the app makes a random secret, sends only its hash when the user signs in, and proves it has the secret when it swaps the code for tokens. A stolen code is useless without it. OAuth 2.1 and current best practice require PKCE for every client, not just mobile apps.

    Most failures are small: a verifier that is too short, a challenge in standard rather than URL-safe base64, a redirect URI that differs between the two requests, or a state that isn't checked. This simulator builds each request, checks the response your browser actually received, and shows where it went wrong.

    How to use it

    1. Enter the endpoints, client_id, redirect URI and scopes.
    2. Use the generated verifier and state, or paste your own.
    3. Open the authorisation URL and sign in.
    4. Paste the URL you were redirected to, then run the token request it gives you.

    FAQ

    What is PKCE?

    An extension to the OAuth code flow (RFC 7636). The app sends a hash of a random secret when the user signs in and the secret itself when redeeming the code, so an intercepted code can't be used.

    Should I use S256 or plain?

    S256. With plain the challenge is the secret itself, so anyone who sees the authorisation request can redeem the code.

    Do I still need state with PKCE?

    Yes, it is still recommended. PKCE stops stolen codes being redeemed; state ties the response to the user's own browser session and carries app context.

    Why is my token request rejected with invalid_grant?

    The code was already used or expired, the redirect_uri differs from the authorisation request, or the code_verifier doesn't hash to the challenge.

    Work with me

    Want a site that gets these right?

    I build fast, accessible websites and web apps that pass these checks from day one. Tell me about your project and I'll reply personally with honest next steps.

    All developer tools · Back to leej.uk