Open Mikodin opened 8 years ago
+1 for this, I've been getting this error constantly. Cannot resolve the login even if it's successful. It has something to do with the deferred promise somehow becoming null. I think there's something wrong with @initDfd()
in submitLogin
@initDfd()
is called in submitLogin
, something goes wrong with the initialization, @dfd
is set to null
handleValidAuth
is called@resolveDfd
is called within handleValidAuth
, but @dfd
is null so it throws an errorNot 100% sure if this is the problem but I've tried tracing it as much as I can @lynndylanhurley any help would be much appreciated
@gerardvcruz @Rayne58
Hmm, have not seen this bug before. It's happen after login via email/pass?
Maybe it is timeout
?
We don't have an error but we have this asynchronous problem with omniauth authentication.
The @dfd
is set to null
then the promise is never resolved.
I ran into this same issue and for me it was the validateOnPageLoad setting. I was calling submitLogin as soon as the page loaded for testing reasons. After a little debugging of what could set @dfd to null I noticed that when validateOnPageLoad is true (the default) it calls validateUser on page load. So if you call anything else that uses @dfd on page load there is a good chance you are going to clobbered by that call to validateUser. The easy fix was to set validateOnPageLoad to false.
I had the same issue and solved it. The problem is the way you are calling the function within your controller. Paste it and I ll show you.
@rubenabergel Hey, I have the same issue. But I use sumbitLogin
directly in form
form ng-submit="submitLogin(loginForm)" role="form" ng-init="loginForm = {}"
.form-group
label for="email" Email
input id="email" ng-model="loginForm.email"
.form-group
label for="password" Password
input type="password" id="password" ng-model="loginForm.password"
.buttons-row
button.btn.btn-primary type="submit" Log In
What is the correct way to call submitLogin
for me?
see how I handle this here by using events.
I noticed that this was a problem back in 2014, #51 and I am having the exact same error. It seems there was no "fix" and maybe it just got patched over or something, but it's popping up for me. I am not doing anything crazy, pretty much what the example is, using the same kind of form.
I am dreadfully sorry for not using
code
but it is formatting all of this horridlyHere is the error angular.js:13236 TypeError: Cannot read property 'resolve' of null at Object.resolveDfd (ng-token-auth.js:374) at Object.handleValidAuth (ng-token-auth.js:572) at ng-token-auth.js:190 at angular.js:10973 at angular.js:15552 at m.$eval (angular.js:16820) at m.$digest (angular.js:16636) at m.$apply (angular.js:16928) at g (angular.js:11266) at t (angular.js:11464)
Here is my controller
theApp.controller('loginCtrl', function($scope,$auth) { $scope.handleLoginBtnClick = function() { $auth.submitLogin($scope.loginForm) .then(function(resp) { console.log("Logged in!?"); // handle success response }) .catch(function(resp) { console.log($scope.loginForm); console.log("Obviously got an error response!"); $scope.loginErrorMessage = "Sorry, but uh we couldn't find you, try again"; // handle error response }); }; });
And finally, my view is exactly what you have in your example, just a form.
Any help would be glorious :), I've been hacking around with it for about 2 hours and I'm just spinning my tires at this point.
Thank you!