Cloudflare Turnstile Setup

Configuration Steps

  1. Get your Turnstile Site Key
  2. Update the HTML files
  3. Supabase Configuration

What Was Integrated

✅ Added Turnstile script to _layouts/default.html ✅ Updated CSP to allow Turnstile domains ✅ Added Turnstile widgets to login and signup forms in index.html ✅ Updated js/auth.js to get and pass captcha tokens ✅ Updated js/lib/api.js to send captcha tokens to Supabase

How It Works

  1. User fills out login/signup form
  2. Turnstile widget validates user (invisible or visible challenge)
  3. On form submit, getTurnstileToken() retrieves the token
  4. Token is passed to Supabase via gotrue_meta_security.captcha_token
  5. Supabase validates the token with Cloudflare before allowing auth

Testing

  1. Try to sign in/up - you should see the Turnstile widget
  2. Complete the captcha
  3. Submit the form
  4. Check browser console for any errors

Troubleshooting