In my Angular 7 application, I am utilizing the ms-adal-angular6
library to handle authentication flow and I am trying to understand the sequence of events in my code.
After successfully authenticating with Azure Active Directory (AAD) using a logged-in user account, I receive a fully populated MsAdalAngular6Service variable containing all necessary properties.
How can I identify if the login process fails during this procedure? Below is the snippet of my code:
export class AppComponent {
constructor(private adalSvc: MsAdalAngular6Service) {
var token = this.adalSvc.acquireToken('http://adal.resource.com').subscribe((token: string) => {
// This works fine for pre-logged in users, token is valid
});
}
}
Where should I implement the logic to detect any failure in this entire process? Our system includes both individual user accounts and Azure AD integration, and users failing to pass the Azure AD step should be redirected to an alternative process.
Is it sufficient to verify the validity of the returned token? The adalSvc
object contains complete user information for individuals who have already completed the Azure AD login.