Cloudflare Turnstile CAPTCHA
Community-contributed integration
This integration is community-maintained. Reference: ory/integrates/fraud-bot-protection/cloudflare-turnstile.
Cloudflare Turnstile is a non-interactive CAPTCHA alternative that uses browser signals, ML, and proof-of-work. It is free with no per-call limit and is privacy-preserving.
How it works
- Registration / login UI embeds the Turnstile client widget; the widget runs the challenge invisibly and returns a token
(
cf-turnstile-response). - Form submits to Ory's flow with the token.
- Ory Action on
registration.after/login.after(withcan_interrupt: true) calls the handler. - Handler POSTs to
https://challenges.cloudflare.com/turnstile/v0/siteverifywith the token + Secret Key; checkssuccess == true. - On fail, handler returns an error and Ory blocks.
Notable
- Two keys: Site Key (public, client widget) and Secret Key (server verify). Never expose Secret.
- The token reaches the webhook in
transient_payload, which exists only once the user submits the flow. Keep the action on theaftertrigger withcan_interrupt: true: abeforeaction runs when Ory Kratos Identities creates the flow and never sees the token. - Tokens are one-time use and expire ~5 minutes after issue.
- Optional
remoteipfield in siteverify enables IP-binding; pass the client IP through your reverse proxy.