You turned on CAPTCHA protection in Supabase to stop bot signups. Now real people can't get in. The signup or login form shows one of these:
captcha verification process failedcaptcha protection: request disallowed (no captcha_token found)captcha protection: request disallowed (timeout-or-duplicate)or(invalid-input-secret)- or just a generic "Something went wrong", with
captcha_failedin the network response
All of these come back with the error code captcha_failed. Supabase's error code list describes it simply: the CAPTCHA challenge could not be verified with the CAPTCHA provider. That covers several very different problems, from a missing token to a wrong secret key. This guide shows how to tell them apart and fix each one on sites built with Lovable, Bolt, v0, Replit and Cursor.
How Supabase CAPTCHA works (30-second version)
There are three parts, and each one can break:
- The widget (hCaptcha or Cloudflare Turnstile) runs on your page using a public site key. When the visitor passes, it gives your page a short-lived token.
- Your code passes that token to Supabase with the auth call, as
options.captchaToken. - Supabase Auth sends the token and your secret key (saved in the Supabase dashboard) to the provider, and only lets the request through if the provider says yes.
When CAPTCHA protection is on, Supabase checks for a token on more than signup. It applies to password sign-in, magic links and one-time codes, password reset, resending emails and anonymous sign-in too. That's the first big surprise for most people.
Step 1: read the exact message
Open your live site in a private window with DevTools open (Network tab). Try the failing form and click the request to /auth/v1/signup, /auth/v1/token, /auth/v1/otp or /auth/v1/recover. The response body tells you which part broke:
| Message in the response | What it means | Go to |
|---|---|---|
request disallowed (no captcha_token found) | Your code didn't send a token at all | Step 2 |
request disallowed (timeout-or-duplicate) | A token was sent but it had already been used, or it expired | Step 3 |
request disallowed (invalid-input-secret) or (missing-input-secret) | The secret key saved in Supabase is wrong or empty | Step 4 |
request disallowed (invalid-input-response) | The token is malformed, expired, or from a different site key | Steps 3 and 4 |
captcha verification process failed | Supabase couldn't get a usable answer from the provider | Step 4, then Step 6 |
If the message ends in a code in brackets, the provider answered and said no. If there's no bracket code and the message is "verification process failed", look first at the key pair and provider choice, because a mismatch there is the most common cause people report.
Step 2: "no captcha_token found" (the token never got sent)
This means CAPTCHA protection is on in Supabase but the request had no token. Three usual causes:
The form that fails has no widget. You added a CAPTCHA to signup, but login, "forgot password" and "send magic link" have none. Supabase rejects all of them. Either add a widget to every form that calls Supabase Auth, or accept that those forms will fail.
The token isn't passed in. The widget is on the page, but the auth call doesn't include it. Every call needs it:
await supabase.auth.signUp({ email, password, options: { captchaToken } });
await supabase.auth.signInWithPassword({ email, password, options: { captchaToken } });
await supabase.auth.signInWithOtp({ email, options: { captchaToken } });
await supabase.auth.resetPasswordForEmail(email, { captchaToken });
Note that resetPasswordForEmail takes captchaToken directly in its options, not inside a nested options object.
The form submits before the token exists. Store the token in state from the widget callback (onVerify for hCaptcha, onSuccess for Turnstile) and keep the submit button disabled until it's set. Generated code often renders the widget but lets people click "Sign up" straight away, so the first try always fails.
A prompt you can paste into your builder:
Every form on my site that calls Supabase Auth (sign up, log in, magic link, forgot password, resend confirmation) must show the CAPTCHA widget, store its token in state, pass it as captchaToken in the Supabase call, and keep the submit button disabled until the token is set.
Step 3: "timeout-or-duplicate" (the token was reused or too old)
CAPTCHA tokens are single-use and short-lived. Cloudflare's docs say a Turnstile token is valid for 300 seconds (5 minutes) and can be validated only once; a second check returns timeout-or-duplicate. hCaptcha tokens also expire after a short time.
This shows up as:
- Second attempt fails. The first try failed for some other reason (wrong password, email already registered), and the form resent the same token. Reset the widget after every auth call, success or failure. Supabase's own guide calls
captcha.current.resetCaptcha()after the call; for Turnstile, callreset()on the widget ref. - Slow forms fail. The visitor solved the challenge, then spent several minutes typing. Reset the widget if the call fails, or render it right before submit.
- You check the token twice. If your own server function also sends the token to the provider before calling Supabase, the provider has already used it up and Supabase's check gets
timeout-or-duplicate. With Supabase CAPTCHA on, let Supabase do the check and remove your own. - React runs the call twice. A submit handler inside an effect, or a double-click on a button that isn't disabled, can send two requests with the same token. Disable the button while the request is in flight.
A pattern that avoids all four:
async function onSubmit() {
setLoading(true);
const { error } = await supabase.auth.signInWithPassword({
email, password, options: { captchaToken },
});
captchaRef.current?.resetCaptcha?.(); // hCaptcha
captchaRef.current?.reset?.(); // Turnstile
setCaptchaToken(null);
setLoading(false);
if (error) showError(error.message);
}
Step 4: wrong keys, or keys from two different widgets
The site key (public, in your page) and the secret key (private, in Supabase) must come from the same widget at the same provider, and the provider chosen in Supabase must match the widget on your page.
Check, in order:
- In the Supabase dashboard, under Authentication settings, find Bot and Abuse Protection. Confirm CAPTCHA protection is on and the provider is the one you actually use (hCaptcha or Turnstile).
- Confirm the saved key is the secret key, not the site key. They look similar. Paste it again fresh from the provider dashboard if in doubt, with no spaces at either end.
- Confirm the site key in your page belongs to the same widget. Projects often end up with two Turnstile widgets (one made in testing, one for production), and the keys get mixed.
- Switched providers? If you moved from hCaptcha to Turnstile, change both sides: the widget and site key in your code, and the provider plus secret in Supabase. A GitHub issue on supabase/auth shows the classic symptom: after a migration, every sign-in failed with
timeout-or-duplicateuntil a mistake in the code was fixed. - Test keys in production. Cloudflare and hCaptcha both publish test site keys that always pass. Production secret keys reject the dummy tokens those test keys create. If your build still uses a test site key, every live request fails.
Step 5: works in preview, fails on your real domain (or the other way round)
This is the one that catches most sites built with AI builders.
Turnstile hostnames. A Turnstile widget only works on the hostnames you list for it in the Cloudflare dashboard. If you listed your custom domain but test in the builder's preview, the widget fails in preview. If you listed the preview address and later connected a custom domain, it fails on the live site. Add every address real people use: the custom domain with and without www, plus the published builder subdomain if it's still reachable. Add localhost only for local testing.
hCaptcha and localhost. Supabase's guide notes that testing hCaptcha locally needs a tunnel or a hosts-file entry, so "it fails on localhost" can be expected and is a different problem from a live failure.
The site key is missing from the production build. If the site key comes from an environment variable (for example VITE_TURNSTILE_SITE_KEY), it has to exist in the production environment, not only the editor. A missing key often means the widget renders nothing, the token stays empty, and you get no captcha_token found. See Blank page after deploy? Check your production env vars and Lovable Site Works in Preview but Not When Published? Find the Difference.
Wrong Supabase project. If preview and live point at different Supabase projects, CAPTCHA may be on in one and off in the other. Check the project address in the failing request. Supabase Auth Broke After Deploy? The Usual Suspects, in Order walks through this.
Step 6: the widget never loads
If the challenge box is missing or spins forever, there's no token, whatever your code does.
- Content Security Policy. If your site sets a CSP header or meta tag, it must allow the provider's script and frame:
challenges.cloudflare.comfor Turnstile, orhcaptcha.comand*.hcaptcha.comfor hCaptcha. Look for "Refused to load the script" or "Refused to frame" in the console. - Ad and privacy blockers. Some browser extensions and privacy browsers block CAPTCHA scripts. Show a clear message ("Please allow the security check to continue") instead of a silent dead button.
- The widget mounts twice or not at all. Generated code sometimes renders the widget inside a component that remounts on every keystroke, which resets the token. Keep the widget outside fast-changing state.
A failing widget is easy to miss because the form still looks normal. It's the same pattern as forms that say thanks but send nothing: the page looks fine, and the real error only shows in the console and network tab.
Step 7: turn it on in the right order
Once Supabase requires a token, every auth request without one fails, including from people who still have your old page open. Roll it out safely:
- Ship the widget and
captchaTokenon every auth form first. Supabase ignores the token while protection is off. - Test signup, login, magic link and password reset on the live site.
- Then switch on CAPTCHA protection in Supabase.
- Test all four flows again on the live domain, in a private window.
If you need a quick way out while you fix things, switching CAPTCHA protection off in the dashboard makes the forms work again straight away. Keep Supabase's built-in rate limits on in the meantime.
How to confirm it's fixed
On your live domain, in a private window:
- Sign up with a new address: the
/auth/v1/signupresponse is 200, not 400 or 500. - Log in with a wrong password, then the right one: the second try works (proves the widget resets).
- Request a password reset and a magic link: both return 200 and the email arrives.
- Wait more than five minutes after solving the challenge, then submit: you get a clear message and a fresh challenge, not a dead form.
If login still fails with "Invalid login credentials" after CAPTCHA passes, that's a separate problem: see Supabase Says "Invalid login credentials"? Find the Real Cause and Fix It. If signup returns "User already registered", see Supabase "User already registered"? Handle Repeat Signups the Right Way.
Catch it before your users do
CAPTCHA failures are silent for you and loud for everyone else: you're already logged in, so you never see the broken login form. Run the free FlowCanary check on your live URL to see the console errors and failed requests a real visitor's browser hits. For ongoing coverage, FlowCanary offers Daily monitoring of your signup, login and checkout (in development; founding spots $19/month, price locked for life, full refund on request any time before it launches).
Further reading
- Supabase Says "Invalid login credentials"? Find the Real Cause and Fix It
- Supabase "User already registered"? Handle Repeat Signups the Right Way
- Supabase Auth Broke After Deploy? The Usual Suspects, in Order
- Blank page after deploy? Check your production env vars
- Form says thanks but nothing arrives? Test it live
- Lovable site health check
