How to setup Google reCAPTCHA in Magento 2

In this blog we will discuss Google CAPTCHA, what is it? and how can we use it?

What is Google reCAPTCHA and its benefits

reCAPTCHA, a service provided by Google to protect your web pages from spam and bots.

  • reCaptcha prevents spam and bot attacks to reduce suspicious access and potential fraud risk
  • reCAPTCHA protects user login, registration and logout processes and ensures that no robots harm our site, ensuring that real people surf our site.

To use CAPTCHA is valid Google website API key and Google API secret key are needed

Magento 2 EU Captcha Extension improves the security of your store – Magento 2 EU Captcha Extension

Google reCAPTCHA in MAGENTO 2

CAPTCHA, short for Completely Automated Public Turing Test to Tell Computers and Humans Apart, reCAPTCHA is a tool that can distinguish automated bots from humans.

In Magento 2, CAPTCHA can be used in both Admin and Frontend areas. Magento supports standard CAPTCHA and Google CAPTCHA.

Enable Google CAPTCHA for Magento interface

In the admin section, go to

Store > Configuration > Security > Google CAPTCHA Storefront

to configure the Google reCaptcha interface:

recaptcha configuration

Three types of Google captcha in Magento


  • reCaptcha v2 (“I’m not a robot”)
  • reCaptcha v2 Invisible
  • reCaptcha v3 Invisible

Here we can configure all three types of reCAPTCHA

1. reCAPTCHA v2 (“I’m not a robot”)

  • Google website API key: Enter the Google captcha account website key
  • Google API Secret Key: Enter the Google captcha account API key
  • Size: Choose a size between Normal or Compact
  • Theme: You can change the theme to Light or Dark
  • Language code: can set language code (two character code)

2. reCAPTCHA v2 Invisible

  • Google website API key: Enter the Google captcha account website key
  • Google API Secret Key: Enter the Google captcha account API key
  • Invisible badge position: choose the position of the badge on each page. positions- Inline / Bottom Right / Bottom Left
  • Theme: You can change the theme to Light or Dark
  • Language code: can set language code (two character code)

3. reCAPTCHA v3 Invisible

  • Google website API key: Enter the Google captcha account website key
  • Google API Secret Key: Enter the Google captcha account API key
  • Minimum result threshold: Score between (1.0 to 0, where 1.0 is typical user interaction and 0.0 is probably a bot)
  • Invisible badge position: choose the position of the badge on each page. positions- Inline / Bottom Right / Bottom Left
  • Theme: You can change the theme to Light or Dark
  • Language code: can set language code (two character code)

Basically, the main common configuration for all three types of reCAPTCHA is –

  1. Google website API key
  2. Google API secret key
recaptcha configuration

We can also configure reCAPTCHA validation and technical error messages –

Store > Configuration > Security > Google CAPTCHA Storefront > reCAPTCHA error messages

recaptcha error message

Finally, we can enable any of the three reCAPTCHAs for frontend forms. some options are below

  • Use in Login
  • Use in Forgot password
  • Use in contact
  • Use in Create User
  • Use in review

Store > Configuration > Security > Google CAPTCHA Storefront > Showcase

recaptcha storefront

Some display of forms with Google reCAPTCHA

Enable Google CAPTCHA for Magento admin

In the admin configuration, reCAPTCHA is also the same as the front end

For admin, you can enable reCAPTCHA for login and forgotten password

recaptcha admin

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *