manishrasrani / ms-adal-angular6

This is a wrapper library for Angular 6+ (Angular 6.X.X and Angular 7.X.X) modules over Microsoft ADAL (Azure Active Directory Authentication Library)
https://www.npmjs.com/package/microsoft-adal-angular6
MIT License
34 stars 13 forks source link

How to handle errors? #10

Closed unsafecode closed 5 years ago

unsafecode commented 5 years ago

What is the supported way of handling login errors?

manishrasrani commented 5 years ago

@unsafecode - what specific login errors are you referring to? If you mean to say what happens when a user enters an invalid username/password on the login screen, that will be handled in AAD and nothing needs to be done on the client app. Only after successful authentication will AAD redirect to your client app.

unsafecode commented 5 years ago

@manishrasrani For instance, we stumbled upon a user whose account was disabled, and every time he tried to login an error was returned by AAD, yet still the redirection happened, and without any token this yielded an infinite loop.

Point is, the AAD login error should fill an ADAL variable in localStorage, and the library should be able to detect it at least.

georgefrick commented 5 years ago

We are also having trouble handling someone who does not have access getting an infinite loop.

manishrasrani commented 5 years ago

@unsafecode - adal.js does set a variable in localStorage / sessionStorage for errors. You can check the status populated in the variables - 'adal.error' and 'adal.login.error'. An empty value indicates no error during Auth. Let me know if this helps.