Backend Integration
The following tutorial will guide you on how to integrate Trustcaptcha into your backend.
Preparation
You should complete the following preparations before you start implementing Trustcaptcha into your backend.
Requirements
- An account with Trustcaptcha and an existing CAPTCHA.
- A backend where Trustcaptcha will be integrated.
Using the Library
Below you will learn how to use the library.
Select Technology
Choose your backend technology.
Add Dependency
To use the Trustcaptcha library, you first need to add the corresponding dependencies to your project.
Fetch Result
You can fetch the verification result from our servers using the CaptchaManager class. You need to provide your secret key and the verification token.
Use the Result
Once you have successfully fetched the verification result, you can plan your next steps based on it. A concrete overview of all the information contained in the verification result and their respective meanings can be found in Technical Details.
Example of an Implementation
The example below shows a possible implementation.
With a POST request to /api/example, the verification token is sent within the request body. Then the result is fetched from the server. If the verification is not passed or the bot score exceeds 0.5, a warning is displayed as an example. Finally, the entire result is returned to the client.
The complete example including source code can be found on Github.