Open drakanor opened 7 years ago
0 is valid, that means it is working. If you got null
, undefined
, an object, a string, or literally anything that isn't a number/integer, then that would be a problem. widget ids comes from recaptcha itself, and are integers, starting at 0. For each instance you create, the number will go up.
Ah, ok. Then there must be another problem with my implementation, because I get the following error when trying to invoke reload() on the widget with id 0:
Error: Invalid ReCAPTCHA client id: 0
` angular .module('ffRecaptcha', ['vcRecaptcha']) .controller('FFRecaptchaController', ['$scope', 'vcRecaptchaService', function($scope, vcRecaptchaService) { $scope.recaptchaWidgetId = null; $scope.recaptchaResponse = null;
$scope.reloadRecaptcha = function() {
$scope.recaptchaResponse = null;
vcRecaptchaService.reload($scope.recaptchaWidgetId);
};
$scope.setWidgetId = function (widgetId) {
$scope.recaptchaWidgetId = widgetId;
};
......
}]);
`
I'm running into this as well with version 4.1.0. The widget it is being set to zero, but a subsequently attempt to reset it fails, claiming that the identifier is invalid. If I change my dependency on angular-recaptcha back to 4.0.3 then the problem goes away and the reCaptcha gets reset correctly. Is there an API change between these versions that I need to take account of?
Yep, not working for me either. It's always 0
I also run into this problem, using build:2017-04-24 (it wouldn´t hurt to have the version number in the js-file).
Going back to build:2015-06-22 solves the problem. Then I can use
<div on-create="set_captcha_widget_id(widgetId)"
vc-recaptcha key="'xyxyxyxyxyxy"
ng-model="captcha_response">
and in set_captcha_widget, I save the id to be used when I want to vcRecaptchaService.reload(id).
+1
Error: Invalid ReCAPTCHA client id: 0
Do we need to pass the client ID?
I see similar issue: Error: Invalid ReCAPTCHA client id: 0 I have only 1 reCaptcha in the view, so if I just reload without a client ID: vcRecaptchaService.reload(); reCaptch is reset and forces the user to answer the captch again.
Any issues if I don't pass a client ID?
The widget ID delivered through on-create is always 0 in my case. My ReCaptcha key is valid, I'm using it on a plain HTML page as well.
<div class="g-recaptcha" vc-recaptcha key="'[mykey]'" ng-model="formData.gRecaptchaResponse" on-create="setWidgetId(widgetId)" on-success="setResponse(response)" on-expire="cbExpiration()"> </div>
$scope.setWidgetId = function (widgetId) { console.log("widgetId: " + widgetId); $scope.recaptchaWidgetId = widgetId; };
console output: widgetId: 0
It was working like that for a while but with current AngularJS 1.6.3 and angular-recaptcha it doesn't work anymore for me when used like shown above.