Note: This article is only relevant for self-managed headless projects.
This article explains how to implement reCAPTCHA with member authentication using the JavaScript SDK.
You'll learn how to:
Install a reCAPTCHA library for your framework. For example, if you're using React, you can install react-google-recaptcha-enterprise.
Important: You must use the enterprise version of a reCAPTCHA library.
Use a Wix site key, not your own, when loading the reCAPTCHA script. You can get Wix keys from the captchaVisibleSiteKey and captchaInvisibleSiteKey properties in the SDK.
Add a visible reCAPTCHA component to your registration or login form. For example:
For invisible reCAPTCHA, the component is hidden and only triggers when needed. For example:
Now, you can use the reCAPTCHA tokens with the register and login methods.
When registering a new member with visible reCAPTCHA, pass the token using the recaptchaToken property. For example:
When logging in with invisible reCAPTCHA, pass the token using the invisibleRecaptchaToken property. For example: