Cloudflare Turnstile (Captcha Alternative) Configuration
This article describes the procedure for configuring Cloudflare Turnstile.
Feature Overview
This article describes the procedure for configuring Cloudflare Turnstile. Cloudfalre Turnstile uses Managed Challenge technology of Cloudflare which first runs a series of javascript challenges gathering signals about the visitor/browser environment by deploying in-browser detections and challenges when a request is made. These challenges are selected based on the behavior exhibited by the visitor. These challenges include, but are not limited to, proof-of-work, proof-of-space, probing for web APIs, and various challenges for detecting browser-quirks and human behavior. With this, Cloudfalre Turnstile tries to detect if the visitor is a human and presents a visual puzzle only when it suspects the visitor is a bot.
Whenever a challenge is resolved by Cloudflare Turnstile, it issues a token. This token is valid for 300 seconds after which the token will no longer be valid and a new challenge needs to be resolved.
This feature helps to make sure that the user interacting with the Klevr portal application is actually human and not a robot. It is used on Password Reset, New User Registration & conditionally on Login (based on configuration settings) pages.
To get this working, the following configurations are required:
Cloudflare Configuration
Choose the account
Go to Turnstile option on the left navigation pane
Click Add site button to create a new site. This will open up a new window which will collect the below details
- Site Name - Give a name to your site
- Domain - Enter the domain information
- Widget Mode - Choose Managed/Non-interactive/Invisible based on your requirement
- Click Create
You'll now have a site created and you'll see two keys - Site Key & Secret Key. Copy these two keys as this will be used in configuring Turnstile in you application. Please note that Secret Key is a sensitive information and should be kept secured.
Application Configuration
Update the pipeline library variable group to include the following:
- Klevr.CloudflareChallengeUrl = <Cloudflare challenge URL (used by the backend to validate the Cloudflare response received on the frontend)>
- Klevr.CloudflareSiteKey = <Cloudflare Site Key obtained on configuring a site on Cloudflare Turnstile>
- Klevr.CloudflareSecretKey = <Cloudflare Secret Key obtained on configuring a site on Cloudflare Turnstile>
- Klevr.CloudflareChallengeOnLogin = <When set to true Cloudflare turnstile is added to Login page>
Last updated on