Published on

A quick look at hCaptcha - I am human!

Authors

hCaptcha is a solution to stop spam from web forms by providing a captcha. Let's take a quick look at its features and how to integrate it.

Features

If you know Google reCaptcha, the feature set of hCaptcha will look very familiar. Captcha-wise, they both come with nearly the same feature set — in fact, hCaptcha aims to be a drop-in replacement for reCaptcha.

In comparison, hCaptcha is more privacy-focused and promises to only collect and use the minimal amount of data necessary to evaluate whether the user is a bot or human. Additionally, users can earn money (for themselves or for charity) when using hCaptcha as the service is paid by the people providing the captchas (e.g., you can pay hCaptcha to categorize your asset library).

Note: for the more advanced features like SSO or invisible/passive modes, you will need a paid plan — see https://www.hcaptcha.com/#plans

hCaptcha Settings

The setup is pretty easy: after creating an account, create a site for your captcha integration. In the site settings you will find your sitekey which you need for any integration. Additionally, you can configure:

  • Hostname restrictions (where this site key can be used)
  • Captcha difficulty
  • Topic preferences for captchas (more of a preference than a must-have filter)

Integrations

As hCaptcha is a drop-in replacement of reCaptcha, basically every reCaptcha integration with configurable URLs and keys will work.

These settings are relevant for most integrations:

  • Api Script: the JavaScript URL to the captcha script
  • Siteverification URL: the URL to the verification endpoint (usually https://hcaptcha.com/siteverify)
  • Public/Private Key: the public site key and the private verification key

Integrate hCaptcha in Laravel, Symfony, etc.

Searching Packagist reveals integrations for several frameworks, for example:

...and as above, any configurable reCaptcha integration should work as well.

Integrate hCaptcha in TYPO3

When I originally evaluated hCaptcha there was no TYPO3 extension yet, so I created a custom extension for TYPO3 v10+. It keeps the integration slim and minimal and provides a custom element type for EXT:form which you can add where necessary.

Extension in TER: https://extensions.typo3.org/extension/hcaptcha/

For older TYPO3 versions, consider using a reCaptcha extension that allows configuring the endpoints and keys to point to hCaptcha.