t49tran / react-google-recaptcha-v3

Google Recaptcha V3 integration for React
MIT License
434 stars 91 forks source link

`recaptcha__xx.js` script is loaded twice #82

Closed matiishyn closed 3 years ago

matiishyn commented 3 years ago

steps to reproduce

  1. start a new CRA app by npx create-react-app my-app
  2. add GoogleReCaptchaProvider as described in docs, make sure you paste your recaptcha key image
  3. start the app and open Network devtools

Actual result

recaptcha__en.js script is loaded twice image

Expected result

recaptcha__en.js script should is loaded twice

versions used

    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-google-recaptcha-v3": "^1.9.4",
    "react-scripts": "4.0.3",

macOS, Google Chrome 90

t49tran commented 3 years ago

Hi @matiishyn , thanks for reporting, I will have a look.

t49tran commented 3 years ago

Hi @matiishyn, after some investigation it turns out that it's a problem with Google recaptcha script, not this library.

In your screenshot, the script injected by react-google-recaptcha-v3 is the api.js right above the two recaptcha__en.js. That script from Google will then inject the recaptcha_en.js and as it is from Google. It's out of my control.

People have reported this issue with Google but they haven't fixed it. You can have a look here: https://github.com/google/recaptcha/issues/236.

Thanks for reporting this but I will close this issue for now.