Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth.login() does not return rejection #88

Closed
mdbudnick opened this issue Feb 22, 2016 · 3 comments
Closed

Auth.login() does not return rejection #88

mdbudnick opened this issue Feb 22, 2016 · 3 comments

Comments

@mdbudnick
Copy link

When there is are invalid Auth.login credentials the failure function is never called. Only a 401 unauthorized access is returned.

My code:
Auth.login($scope.user).then(function(){
$state.go('home');
}, function(error){
// never called
});

@leomao10
Copy link
Contributor

@Coroecram That is because you enable AuthIntercept for your application. And AuthInterceptor return a promise that haven't been rejected or resolved, you can see more details in #86

In your example, you can ignore the intercepor by passing interceptAuth: false to login method, like this:

Auth.login($scope.user, { interceptAuth: false }).then(function(){
  $state.go('home');
}, function(error){
  // Error handing
});

TheOneTheOnlyDavidBrown added a commit that referenced this issue Feb 25, 2016
reject promise in AuthInterceptor when status is 401
closes #86 #88 #89
@TheOneTheOnlyDavidBrown
Copy link
Contributor

closed in #89

@mdbudnick
Copy link
Author

@leomao10 Thank you very much, I got that from a tutorial which then acted like it still handled the errors normally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants