TrustComponent
Scala
TrustCaptcha · Bot protection

Scala CAPTCHA Integration

Stop fake sign-ups, login brute force and form spam in your Scala apps in minutes with TrustCaptcha's Scala CAPTCHA integration. You get a pass or fail plus a risk score to route or block suspicious traffic. Privacy-first, EU-hosted and built for accessibility: no cookies, no image puzzles.

Quickstart

How the integration works

1. Create a CAPTCHA

Create a user account or log in with an existing one. Then create a new CAPTCHA or pick an existing one. If you want to try TrustCaptcha first, every plan comes with a 14-day free trial.

The CAPTCHA overview page shows your site key and license key, and you create your API key there. Add your website’s domains to the authorized domains in the CAPTCHA security rules so they can use your CAPTCHA.

Start of the CAPTCHA creation form.
CAPTCHA security rules of a demo CAPTCHA.

2. Integrate the CAPTCHA widget into your frontend

Integrate the CAPTCHA widget into your website or app. The CAPTCHA widget guide in our documentation has step-by-step instructions.

Read the documentation

The CAPTCHA widget will then be displayed on your website or app:

CAPTCHA start

Pre-built frontend integrations
Our pre-built frontend integrations add the CAPTCHA widget to your website or application. If there is none for your frontend technology yet, your developers can integrate the widget themselves using our documentation or ask our support team for a pre-built integration.

Angular
Contact Form 7
Craft CMS
JavaScript
Joomla
JTL-Shop
Keycloak
Magento 2
React
Shopware 6
Svelte
TYPO3
Vue
Webflow
WordPress

3. Validate the CAPTCHA result in your backend

The following steps show how a Scala backend fetches the CAPTCHA verification result from our server and decides what to do with it. For the full instructions, read the CAPTCHA integration guide for Scala in our documentation.

Read the documentation

First, add our TrustCaptcha Scala dependency:

Maven Central
XML
<dependency>
  <groupId>com.trustcomponent</groupId>
  <artifactId>trustcaptcha</artifactId>
  <version>3.0.0</version>
</dependency>

Fetch the verification result from our server with the verification token and your API key:

Fetch Result
Scala
// Retrieving the verification result
var verificationResult: VerificationResult = null
try {
  verificationResult = TrustCaptcha.getVerificationResult("<your_api_key>", "<verification_token_from_your_client>")
} catch {
  case e: CaptchaFailureException =>
    // Fetch verification result failed - handle error
}

Based on the verification result and your own requirements, decide how to proceed:

Handle Result
Scala
// Act on the verification result
if (!verificationResult.isVerificationPassed || verificationResult.getScore > 0.5) {
  // Verification failed or bot score > 0.5 - possible automated request
}

Need detailed information about the Scala CAPTCHA integration?
Our Scala CAPTCHA integration guide has the detailed instructions, and our CAPTCHA samples repository on GitHub has a complete integration example.

Other backend technology instead of Scala?
If you run something other than Scala on your server, or have several backends, pick a different integration here. If we have no pre-built integration for your backend technology yet, your developers can integrate the CAPTCHA verification themselves using our documentation or ask our support team for a pre-built integration.

.NET
Go
Groovy
Java
Kotlin
Node.js
PHP
Python
Ruby
Rust
Scala

4. Test your integration

TrustCaptcha is now active. Send a test request and check that it goes through.

CAPTCHA done

FAQs

How does a Scala CAPTCHA check work?
A Scala CAPTCHA is a check your backend runs before it processes a request. A good CAPTCHA balances bot protection, privacy and ease of use, so TrustCaptcha needs no puzzle: the widget solves a proof-of-work task in the background, sends signals for the risk assessment and adds a verification token to the form. Your Scala controller passes that token and your API key to TrustCaptcha.getVerificationResult and gets a pass or fail plus a bot score. That stops fake sign-ups, credential stuffing and form spam before your code touches the request.
Can I use it with Play Framework or Akka HTTP?
Yes. It is a plain JVM library from Maven Central (com.trustcomponent:trustcaptcha), so you add it with sbt and call it from a Play controller, an Akka HTTP route or any other Scala service. Read the verification token from the form or JSON body, check it and only then process the request.
The call is blocking. How do I use it with Futures?
getVerificationResult makes a blocking HTTP call with default timeouts of 3 seconds to connect and 5 seconds to read. In asynchronous code, run it inside a Future marked with scala.concurrent.blocking, or on an execution context meant for blocking work, so it does not tie up your default dispatcher. If you need other timeouts or a proxy, build one instance with TrustCaptcha.builder(apiKey) at startup; it is immutable and thread-safe.
How do I test my Scala app without solving the CAPTCHA?
From the Team plan you can create bypass keys for automated tests. They always pass the CAPTCHA with a bot score of 0, so your integration tests and CI pipeline can call protected endpoints. In unit tests, put the TrustCaptcha call behind a small trait of your own and stub it. Keep bypass keys out of your production configuration.
Is TrustCaptcha GDPR-compliant for EU projects?
TrustCaptcha stores and processes CAPTCHA data exclusively in the EU on ISO 27001-certified infrastructure and never sets cookies. You can sign the Data Processing Agreement online. Whether your project is compliant depends on your setup; this is not legal advice, so check the details with your data protection officer.
Can I customize the look of TrustCaptcha in my Scala app?
Yes. You can choose a light or dark theme or follow the system setting, use 37+ languages ready to use, add any other language and override every widget text. From the Team plan you can change colors, borders and corner radius. A widget without our branding and a fully invisible widget are the paid Captcha Branding add-on. You set all of this on the widget in your frontend, so it works with whatever renders your Scala app's pages.
How does TrustCaptcha improve accessibility over image-based CAPTCHAs?
Image CAPTCHAs ask users to read distorted text or click small pictures, which is a barrier for screen-reader and keyboard users. TrustCaptcha starts its proof-of-work automatically when the visitor interacts with the form, and there is nothing to solve. The widget ships with ARIA labels and screen-reader text and is designed to meet WCAG standards and the European Accessibility Act.
Losing leads to CAPTCHAs?

TrustCaptcha blocks spam and bots, not customers. No puzzles, GDPR-compliant, EU-hosted.

CAPTCHA start
CAPTCHA done
No puzzles for visitors
The check runs in the background while visitors type, so more people finish your forms instead of giving up.
GDPR-compliant
Hosted in the EU, no cookies, encrypted transmission and automatic data deletion. Every customer gets a Data Processing Agreement.
Multi-layer security
Adaptive proof-of-work and risk scoring stop abuse early, even when attack traffic spikes.
Full control
Set the sensitivity, keep allow and block lists and use geoblocking. You decide how strict the check is.

Protect your Scala application with TrustCaptcha in just a few steps!

  • EU-hosted & GDPR-compliant
  • No puzzles
  • Try free for 14 days