App Finishers

Fix guide · updated 2026-11-16

Supabase "captcha protection: request disallowed"

AuthApiError: captcha protection: request disallowed (no captcha_token found) · captcha_failed · 400

Your sign-in or sign-up form fails with "captcha protection: request disallowed", for example right after someone turned on CAPTCHA protection in Supabase, or only on the second try. The words in brackets tell you which problem you have. We ran Supabase's real Auth server and supabase-js 2.119 on our machine, with a stand-in for hCaptcha and Cloudflare Turnstile that answers the way their docs say, to see exactly when it happens. The surprise: Supabase checks the CAPTCHA before the password, so a typo in the password uses up the token, and the corrected second try fails.

What the error means

With CAPTCHA protection on, Supabase Auth wants a token from your CAPTCHA widget with each sign-up and sign-in. It sends the token to hCaptcha or Cloudflare, whichever you picked in the dashboard, and refuses the request with HTTP 400, code captcha_failed, when no token came or the provider said no. In supabase-js that's an AuthApiError with error.code === 'captcha_failed'. The browser's Network tab shows:

400 {"code":"captcha_failed","message":"captcha protection: request disallowed (no captcha_token found)"}

Then read the brackets:

Everything except "no captcha_token found" is the provider's own error code, passed through as it came.

Which calls need a token

With CAPTCHA on, each of these failed without a token in our test. This is where the token goes:

supabase.auth.signUp({ email, password, options: { captchaToken } })
supabase.auth.signInWithPassword({ email, password, options: { captchaToken } })
supabase.auth.signInWithOtp({ email, options: { captchaToken } })   // magic links and codes
supabase.auth.signInAnonymously({ options: { captchaToken } })
supabase.auth.resend({ type: 'signup', email, options: { captchaToken } })
supabase.auth.resetPasswordForEmail(email, { captchaToken })        // not inside options

Supabase's code also checks single sign-on (SSO), Web3 and passkey sign-ins. These went through without a token: verifyOtp, refreshSession, updateUser, getUser, signOut, the redirect that signInWithOAuth starts (Google, GitHub and the rest), and the auth.admin functions. Supabase's code also skips the check for exchangeCodeForSession and signInWithIdToken.

A client made with the service_role key skipped the check too: signUp and signInWithPassword went through without a token. Don't use that to make the error go away. It turns the protection off for every request your server makes for a visitor, and that key must never reach a browser.

1. "no captcha_token found": your call sent no token

In our test, each of these got it:

supabase.auth.signUp({ email, password })                           // no token
supabase.auth.signUp({ email, password, captchaToken })             // not in options: ignored
supabase.auth.signUp({ email, password, options: { captchaToken: undefined } })  // widget not done
supabase.auth.signUp({ email, password, options: { captchaToken: '   ' } })      // spaces = none
supabase.auth.resetPasswordForEmail(email, { options: { captchaToken } })       // wrong place here

The usual causes:

A widget inside a <form> adds its token as a hidden field: h-captcha-response for hCaptcha, cf-turnstile-response for Turnstile. On the server, read it and pass it on:

'use server'
export async function signIn(formData) {
  const supabase = await createClient() // your server client
  const { error } = await supabase.auth.signInWithPassword({
    email: formData.get('email'),
    password: formData.get('password'),
    options: { captchaToken: formData.get('cf-turnstile-response') }, // hCaptcha: 'h-captcha-response'
  })
  // ...
}

With CAPTCHA on, this error can hide other problems. In our test, signInAnonymously() on a project with anonymous sign-ins off said "no captcha_token found". Only with a token did it say "Anonymous sign-ins are disabled".

2. "already-seen-response" or "timeout-or-duplicate": the token was already used

Each token works once: both providers' docs say so. And Supabase spends it first: it asks the provider before it looks at the password, the account or the email limits. In our test, each of these used up its token, then failed for its own reason:

The person fixes the typo and clicks again, and the same token goes out a second time. hCaptcha answers already-seen-response, Turnstile timeout-or-duplicate, and Supabase shows that in the brackets. The fix: a new token for every attempt, whatever the outcome. Reset the widget in finally:

const captcha = useRef(null)
const [captchaToken, setCaptchaToken] = useState(null)
const [busy, setBusy] = useState(false)

async function signIn() {
  setBusy(true)
  try {
    const { error } = await supabase.auth.signInWithPassword({ email, password, options: { captchaToken } })
    if (error) setError(error.message)
  } finally {
    setCaptchaToken(null)
    captcha.current?.resetCaptcha() // Turnstile: captcha.current?.reset()
    setBusy(false)
  }
}

// hCaptcha (@hcaptcha/react-hcaptcha)
<HCaptcha ref={captcha} sitekey="…" onVerify={setCaptchaToken} onExpire={() => setCaptchaToken(null)} />
// or Turnstile (@marsidev/react-turnstile)
<Turnstile ref={captcha} siteKey="…" onSuccess={setCaptchaToken} />

<button disabled={!captchaToken || busy} onClick={signIn}>Sign in</button>

Disabling the button while the request runs also keeps a double click from sending one token twice. Supabase's own CAPTCHA guide also resets the widget after calling signUp.

Why it worked when you tested: test keys hide this. hCaptcha's test key pair always produces the same token, and that token always passes. Cloudflare's "always passes" test secret does what it says. The second try only fails with real keys.

3. "expired-input-response": the token is too old

hCaptcha tokens expire after 120 seconds by default, Turnstile tokens after 300 seconds (Turnstile reports that as timeout-or-duplicate). Someone solved the CAPTCHA, then took their time with the rest of the form. With hCaptcha, clear the token when it expires, as the onExpire above does, so the button waits for a new one. Turnstile's widget fetches a new token by itself when one expires, unless you changed its refresh-expired setting, and hands it to the same onSuccess callback.

4. "invalid-input-response": the provider doesn't recognise the token

Both providers use this code for a token that's invalid or malformed. The common reasons:

5. "invalid-input-secret" and other key errors: fix your keys

These are about your setup, not your visitor. In the Supabase dashboard, open Authentication → Attack Protection and check Choose Captcha Provider and Captcha secret. Supabase never sees your site key: in our test, it sent the provider the secret from that field, the token and the visitor's IP address, nothing else.

Turnstile has the same trap: its test site keys make a dummy token, XXXX.DUMMY.TOKEN.XXXX, and Cloudflare's docs say real secret keys reject it. Supabase keeps one secret per project, so test keys and real keys can't both work against one project. Give development its own Supabase project (or the local CLI stack) with the test secret, and keep the real secret on production. To test real keys on localhost, Cloudflare lets you add localhost to the widget's hostnames; hCaptcha doesn't allow localhost and suggests a hosts-file entry instead.

HTTP 500 "captcha verification process failed"

This one isn't captcha_failed: Supabase got no usable answer from the provider. In our test, with the provider unreachable, the Network tab showed:

500 {"code":"unexpected_failure","message":"captcha verification process failed"}

supabase-js returned it as an AuthRetryableFetchError with status 500 and no code. The same call worked once the provider was back. On Supabase's hosted platform, that points at trouble reaching hCaptcha or Cloudflare: try again a little later. If you host Supabase yourself, the Auth server must be able to reach hcaptcha.com or challenges.cloudflare.com over HTTPS. Its log line for the request names the actual failure.

If an AI tool built your app

Give your AI tool this prompt:

CAPTCHA protection is on in Supabase. Add the CAPTCHA widget the project uses (hCaptcha or Cloudflare Turnstile, the same provider as in the Supabase dashboard) to every form that calls supabase.auth.signUp, signInWithPassword, signInWithOtp, signInAnonymously, resend or resetPasswordForEmail. Pass the widget's token as options.captchaToken (for resetPasswordForEmail: captchaToken in the second argument). Keep the submit button disabled until the widget has given a token, and while the request runs. After every call, success or failure, clear the token and reset the widget. Don't change anything else.

Not quite your error?

Still stuck?

Open the Auth logs in your Supabase dashboard at the time of the error. Each refused request shows its path (/signup, /token, /otp, /recover, /resend) and the full message with the brackets. The path tells you which call to fix; the brackets tell you which section above applies.

Other Supabase problems? See Supabase fixes.