Closed rodneyjoyce closed 6 years ago
If you're using the window mode redirect and you have set in the adalService configuration the postLogoutRedirectUri
then in the component called by routing into postLogoutRedirectUri in the OnInit function you can handle the callback of the login process with the function handleWindowCallback()
that saves all the parameters in the cache. Then if you need the token you can use acquireToken (that finds out the token from the cache) and subscribe to its retriving as in this code:
this.adalService.handleWindowCallback();
this.adalService.acquireToken(environment.tokenServiceId).subscribe({
next: (token) => {
localStorage.setItem('token', token);
// redirect to home page
}
});
I thinks there is no way to know if the login is successful or not because in case of error you remain in the microsoft login form....
Thank you, I've decided to use an HTTP Interceptor to check tokens every time as opposed to an event on login.
Hi,
After login I want to show a message if it is successful or an error if not, however it is a void method which means I have no way of knowing when it completes - should it not return a promise or callback?