bharathraj-e / g_recaptcha_v3

Create Google reCAPTCHA v3 token for Flutter web.
https://pub.dev/packages/g_recaptcha_v3
MIT License
11 stars 8 forks source link

Recapthca v3 isNotABot function return null value #8

Closed cerenyasa97 closed 1 year ago

cerenyasa97 commented 1 year ago

Hello, I used this package with the tutorial which link is below

https://levelup.gitconnected.com/how-to-implement-google-recaptcha-v3-in-flutter-web-38000139bbc0

but when I run project in debug mode recaptcha verification is completed successfully. After then, I deploy my project on Firebase hosting, isNotABot function returns null. All of my codes are as same as tutorial. I do not get error, and I do not know why this function return null. I added my domain address on Firebase to recapctha settings.

bharathraj-e commented 1 year ago

Hi @cerenyasa97 , can you provide the error log/screenshot & what version of this package u have used.

cerenyasa97 commented 1 year ago

The error is given below. Web app work correctly on localhost, but after I deploy to Firebase I get this error.

Access to XMLHttpRequest at ‘https://www.google.com/recaptcha/api/siteverify’ from origin >‘https://.....xxx.........app’ has been blocked by CORS policy: Response to preflight request doesn’t pass access >control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

bharathraj-e commented 1 year ago

Did you add your firebase hosting domain (your-app-name.web.app) in recaptcha console?

cerenyasa97 commented 1 year ago

Yes I added both localhost and flrebase hosting domain.

senthilnasa commented 1 year ago

@cerenyasa97 #4

I figured out that you are trying to verify the captcha token on the client side(browser). It would be best if you did not do that on the client side.

You must pass the token to a backend server and verify.