Closed xinthose closed 1 year ago
Nevermind. I stopped using this library and use the generic code instead. No more issues.
npm i @types/grecaptcha
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Portapay.com</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="referrer" content="strict-origin">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<script src="https://www.google.com/recaptcha/api.js?render=asfasdfsdfdd324234234"></script>
</head>
<body>
<app-root></app-root>
</body>
</html>
import "node_modules/@types/grecaptcha/index.d.ts";
const token: string = await grecaptcha.execute("asfasdfsdfdd324234234", { action: "login" });
// verify token server side
Sometimes my users get this error
Invalid site key or not loaded in api.js XXXXXXXXXX
from my website when I call therecaptchaV3Service.execute
method. What fixes it is, they have to clear their cache for all time, reload the webpage, and try again, then it works. I never get the issue from my computer, so this is hard to replicate/solve. The site key shown in the console error is the correct one for my website/domain.I am using Google reCaptcha v3. ng-recaptcha version 12.0.1.
app.modules.ts
login.component.ts