R
R
Roman Rakzin2022-01-06 08:44:39
Angular
Roman Rakzin, 2022-01-06 08:44:39

Recaptcha v3 doesn't always work on Angular. What could be the reason for this?

What could be the reason why the captcha works every other time?
I see the following error.
Moreover, I have authorization from two places - from the login + password form and in another place - by pressing the "Demo mode" button.
Moreover, in the login + password form, everything always works, and when you try to press a button and log in in test mode, it writes an error. But not always. I do not understand what it is connected with.

ERROR Error: Invalid site key or not loaded in api.js: null
            at Array.<anonymous> (recaptcha__uk.js:384)
            at recaptcha__uk.js:30
            at ReCaptchaService.execute (angular-recaptcha3.js?7188:53)
            at LoginService.demoLogIn (login.service.ts?1df9:131)
            at IorderDescriptionSectionComponent.demoLogin (iorder-description-section.component.ts?e047:17)
            at IorderDescriptionSectionComponent_Template_button_click_17_listener (template.html:23)
            at executeListenerWithErrorHandling (core.js?7d7a:15279)
            at wrapListenerIn_markDirtyAndPreventDefault (core.js?7d7a:15317)
            at HTMLButtonElement.eval (platform-browser.js?8e13:592)
            at ZoneDelegate.invokeTask (zone.js?d135:421)


I use this library

import { ReCaptchaService } from 'angular-recaptcha3';


everything works 100% in the form of entering a password and then receiving a token.
But in another place, when I click the "Enter in demo mode" button, I also want to get a token, but it doesn't work here. More precisely, it can work, but for a reason unknown to me, or if I "put" the data in the password entry form - it may seem nonsense, but as if when the form is dirty, the captcha will always work, although I press the button in a different place for the Demo mode .
What can be done here and how to solve it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question