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:
- no captcha_token found: your call sent no token. Supabase says this itself, without asking the provider (section 1).
- already-seen-response (hCaptcha) or timeout-or-duplicate (Turnstile): the token was already used. Turnstile also says it when the token is more than 5 minutes old (section 2).
- expired-input-response (hCaptcha): the token is more than 2 minutes old (section 3).
- invalid-input-response: the provider doesn't recognise the token (section 4).
- invalid-input-secret, missing-input-secret, sitekey-secret-mismatch or not-using-dummy-passcode: your keys don't match (section 5).
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:
- CAPTCHA was just turned on and the app never sends tokens. Every call in the list above breaks at once, including the "Forgot password?" page and the "Resend email" button.
- The form went out before the widget gave a token. Keep the submit button disabled until the widget's callback has handed you one (
onVerifyfor hCaptcha,onSuccessfor Turnstile). - The call runs on your server (a Next.js server action or API route) and the token stayed in the browser. See below.
- It works locally but not in production. The local Supabase stack (the CLI) leaves CAPTCHA off unless you uncomment
[auth.captcha]insupabase/config.toml, so it never asked for a token.
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:
- a wrong password, or an email with no account ("Invalid login credentials"),
- a password that's too short ("Password should be at least 6 characters."),
- a "Resend email" click less than a minute after the last email ("For security purposes, you can only request this after … seconds."),
- a sign-in right after a sign-up that worked, with the same token.
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:
- The widget and the dashboard name different providers. In our test, Supabase sent the token to the provider chosen in the dashboard (
hcaptcha.com/siteverifyorchallenges.cloudflare.com/turnstile/v0/siteverify), whichever widget made it. A Turnstile token can't pass at hCaptcha, and the other way round. - The value isn't the widget's current token, for example one kept from an earlier render or another form on the page.
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.
- invalid-input-secret or missing-input-secret: the secret is wrong. Most often the site key was pasted in its place (the site key is the public one in your page's code; the secret stays private). It can also be the other provider's secret, or a secret you rotated at hCaptcha or Cloudflare and never updated in Supabase.
- sitekey-secret-mismatch (hCaptcha): the site key in your page isn't registered with that secret, for example a site key from another hCaptcha account.
- not-using-dummy-passcode (hCaptcha): your page uses hCaptcha's test site key, but Supabase has your real secret.
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?
- Sign-in says the email or password is wrong: Supabase "Invalid login credentials".
- Too many tries from one place: Supabase "Request rate limit reached".
- Too many emails: Supabase "email rate limit exceeded".
- Guest sign-in refused: Supabase "Anonymous sign-ins are disabled".
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.