Skip to content
FirstUser

For builders shipping this week

"CAPTCHA verification failed" on signup? 5 checks for Supabase apps

You turned on CAPTCHA to stop bot signups, and now real people can't sign up either. FirstUser opens your live URL like a brand-new visitor, signs up, logs in and tells you which step failed, with a screenshot and a fix prompt for Lovable, Bolt or Cursor. Run a free signup test.

Supabase Auth can protect sign-up, sign-in and password reset with hCaptcha or Cloudflare Turnstile. When the check fails, Supabase returns the error code captcha_failed: "CAPTCHA challenge could not be verified with the CAPTCHA provider." Your own browser often passes, because you tested before the switch, on localhost, or with an old session. A stranger hits it on the very first click.

1. CAPTCHA is on in Supabase, but the form never sends a token

The switch lives in the Supabase dashboard under Authentication > Bot and Abuse Protection. Supabase's CAPTCHA protection guide covers sign-in, sign-up and password-reset forms. The moment the switch is on, every protected auth call needs a token from the widget. An AI-generated signup form that just calls signUp({ email, password }) will fail for everyone.

Fix: render the widget, store its token, and pass it:

await supabase.auth.signUp({
  email,
  password,
  options: { captchaToken },
})

Do the same for every form Supabase protects: sign-in and password reset too, not only signup. A common pattern: signup got fixed, login didn't, so new users register and then can't get back in.

2. The token was already used, or it expired

A CAPTCHA token is good for one check. Turnstile tokens are valid for 300 seconds and are single-use. Typical breakages:

  • The user mistypes the password, the first call fails, they try again, and the form sends the same token.
  • The user fills the form slowly or switches tabs to find a password, and the token is older than five minutes.
  • React re-renders and keeps the old token in state.

Fix: reset the widget after every auth call, success or failure (Supabase's example calls captcha.current.resetCaptcha()), clear the stored token, and handle the widget's expire callback by clearing it there too.

3. The widget isn't allowed on the domain your users actually use

Turnstile and hCaptcha only run on hostnames you authorize. If you set it up on the editor preview or a *.lovable.app / *.netlify.app address and later moved to your own domain (or the other way round, or www vs. no www), the widget fails on the live site. For local testing, Turnstile needs localhost in its domain list, and hCaptcha needs ngrok or a hosts-file entry.

Fix: add every hostname real users open: custom domain, www variant, and the published app URL if people still use it.

4. Site key and secret key don't belong together

The site key sits in your frontend code; the secret key goes into Supabase. They must come from the same widget (Turnstile) or the same site/account (hCaptcha), and the provider picked in Supabase must match the widget you render. Mixing a Turnstile widget with an hCaptcha secret, or a site key from an old widget, fails every check.

Fix: copy both keys again from the same widget, paste the secret into Supabase, save, and redeploy the frontend if the site key is baked into the build (VITE_ / NEXT_PUBLIC_ variables only change on a new build).

5. The submit button works before the CAPTCHA is solved

Generated forms often let the user click "Sign up" while the widget is still loading or showing a challenge. The call goes out with an empty token and fails, and the user just sees "Something went wrong".

Fix: disable the submit button until the widget's success callback (onSuccess for Turnstile, onVerify for hCaptcha) has fired, and map error.code === 'captcha_failed' to a plain message like "Please complete the check and try again", next to the widget. Supabase's auth error-code guide describes captcha_failed as the challenge that could not be verified with the CAPTCHA provider.

Test it like a stranger, after every deploy

Use a fresh browser profile, your real live domain, and an email address that has never signed up. Sign up, confirm, log out, log back in, and reset the password: every form CAPTCHA protects. If that's too much to repeat after each change, let FirstUser be the first user.

FAQ

Should I just turn CAPTCHA off?

If bots were filling your signup or burning your email quota (see Email rate limit exceeded at /supabase-email-rate-limit-exceeded), keep it on and fix the integration. If you never had bot traffic, turning it off is a valid choice, but then test the plain flow again.

Why does it work for me but not for others?

You may be testing on localhost or the preview domain with different keys, re-using a session from before CAPTCHA was on, or never hitting the second try that re-sends a used token.

After the CAPTCHA passes, users still can't log in.

Then it's usually email confirmation. See "Email not confirmed" or "Invalid login credentials" right after signup at /supabase-email-not-confirmed.

Can FirstUser test an app that has CAPTCHA turned on?

The run still opens your URL and tries sign-up and login. When it finds an email field and a password field, it fills them and clicks the visible submit control. The test does not look for a Turnstile, hCaptcha, or reCAPTCHA widget and does not solve one. If the click throws, that error is ignored and the step is still recorded as submitted. Only text in a role=alert or data-error element that is not hidden is stored as the error: sign-up is then failed with "The sign-up form was rejected", login with "Login was rejected", and the diagnosis includes that text. If the page shows no success state, sign-up fails with "Sign-up was submitted, but the page did not show a success state" and login with "Login was submitted, but the app did not show a signed-in state". Each step that runs saves a JPEG screenshot of the page. When sign-up does not pass, email confirmation is skipped and that step has no screenshot. The run does not request a password reset.

Checklist

Get this checklist by email

We will email this checklist to that address. Privacy policy

Sources