Usage
First, make sure Cap Standalone is installed and running by following the installation guide.
Then, you can get to using Cap Standalone:
Client-side
Let's configure your widget to use your self-hosted Cap Standalone server. To do this, set the widget's API endpoint option to:
https://<instance_url>/<site_key>/
Make sure to replace:
<instance_url>
: The actual URL where your Cap Standalone instance is running. This URL must be publicly accessible from the internet.<site_key>
: Your site key from this dashboard.
Example:
<cap-widget
data-cap-api-endpoint="https://cap.example.com/d9256640cb53/"
></cap-widget>
Server-side
After a user completes the CAPTCHA on your site, your backend needs to verify their token using this server's API.
You can do this by sending a POST
request from your server to the following endpoint:
https://<instance_url>/<site_key>/siteverify
Your request needs to include the following data:
secret
: Your key secret from this dashboard. This is not the admin key, but rather your site key's secret.response
: The CAPTCHA token generated by the widget on the client-side
Example using curl
:
curl "https://<instance_url>/<site_key>/siteverify" \
-X POST \
-H "Content-Type: application/json" \
-d '{ "secret": "<key_secret>", "response": "<captcha_token>" }'
The response should look like this:
{
"success": true
}
Or, if the captcha token is invalid or expired, it will return:
{
"success": false
}
If success
is true, you can proceed with your app logic.
Client-side library storage
To learn more about using the client-side library, check out the guide on it.