我在登录页面上已实现Google reCaptchaV3我想通过向https://www.google.com/recaptcha/api/siteverify发送请求来获得分数我的代码发送发送请求,如下所示:
var x = this.http.post<RecaptchaResponse>(`https://www.google.com/recaptcha/api/siteverify?secret=${this.secret}&response=${this.token}`, null) .pipe( map(data => new RecaptchaResponse().deserialize(data)), catchError(() => throwError('No Score')), );
但是我得到了错误
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.
我确实尝试了以下方法:1)在管理控制台上添加“ localhost”2)在管理控制台上添加127.0.0.13)禁用“验证reCAPTCHA解决方案的来源”选项
但是以上都不起作用。关于如何在本地主机中测试reCaptcha的任何想法吗?因为它在Postman上工作,但在localhost上却没有。
我已经在我的登录页面上实现了Google reCaptchaV3,我想通过向https://www.google.com/recaptcha/api/siteverify发送请求来获得分数,如下所示。
使用代理配置proxy.conf.json
{
"/recaptcha": {
"target": "https://www.google.com/",
"secure": false
}
}