How to use
- Press Generate for a new random code_verifier, or paste one.
- The code_challenge is computed as BASE64URL(SHA-256(code_verifier)).
- Send code_challenge with code_challenge_method=S256 in the authorization request.
- Send the code_verifier in the token request.
PKCE (Proof Key for Code Exchange, RFC 7636) protects the OAuth 2.0 authorization code flow. It was designed for public clients such as mobile apps, desktop apps and single-page web apps, which cannot keep a client secret. Before redirecting the user, the client creates a one-time secret called the code_verifier and sends only its hash, the code_challenge. When it later exchanges the authorization code for tokens, it sends the original verifier and the server checks that the two match, so someone who intercepts the code alone cannot use it.
This generator takes 32 random bytes from the browser’s crypto.getRandomValues and encodes them as base64url without padding, which gives a 43-character verifier. The challenge is the SHA-256 of the verifier, again base64url-encoded without padding, and is always 43 characters long. Only the S256 method is offered: RFC 7636 also defines plain, but requires S256 whenever the client can compute SHA-256. Use it to debug a login integration, compare your library’s output, or build test requests by hand.
A pasted verifier is hashed as-is and is not checked against the RFC rules, so make sure yours has 43 to 128 characters from A–Z, a–z, 0–9, “-”, “.”, “_” and “~”. Create a new verifier for every authorization request. Both values are computed on this page with the Web Crypto API and are never sent anywhere.