On my page, I have a contact form with Captcha verification. I’ve followed the Wix Velo Captcha tutorial very closely, but I still get the following console errors:
InvalidCaptchaError: Submit failed due to invalid reCaptcha
Error processing captcha submission: Error: Request failed with status code 400
Front end page code:
import wixData from 'wix-data';
import wixWindow from 'wix-window';
import { processSubmission } from 'backend/submitHandler';
export function btnSubmit_click(event, $w) {
let token = $w("#captcha").token;
processSubmission(token)
.then(() => {
// ...
});
}
export function captcha_verified() {
$w('#btnSubmit').enable();
$w('#txtMessage').hide();
}
backend/submitHandler.jsw
import wixCaptchaBackend from 'wix-captcha-backend';
export function processSubmission(token) {
return wixCaptchaBackend.authorize(token)
.catch((error) => {
console.log("Error processing captcha submission: " + error); // Error called every time
})
}
If this is literally the same code from the Velo tutorial, why am I still getting these errors?