Google reCaptcha blocked by CORS policy from LocalHost

2026 views
Skip to first unread message

Jay Chuah

unread,
Nov 30, 2019, 11:35:01 PM11/30/19
to reCAPTCHA
I have implement Google reCaptchaV3 on my login page  
I would like to get the score by sending request to https://www.google.com/recaptcha/api/siteverify  
My code to sent post request like following  

      .pipe(
        map(data => new RecaptchaResponse().deserialize(data)),
  catchError(() => throwError('No Score')),
    );

However I get the error

    Access to XMLHttpRequest at 'https://www.google.com/recaptcha/api/siteverify?secret=SECRET&response=TOKEN' from origin 'http://localhost:50000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I did try the following approach:  
1) Add 'localhost' on admin console  
2) Add 127.0.0.1 on admin console  
3) Disable 'Verify the origin of reCAPTCHA solutions' option

However none of above were working.  
Any idea on how to test the reCaptcha in localhost?  
As it's working on Postman but not on localhost.
Reply all
Reply to author
Forward
0 new messages