Skip to content

Active Directory logging out without a redirect to Default Microsoft Logout Page in Angular 2

I have implemented Angular 2 Multi tenant application. I’m able to logout for the active Directory by using below method

    logout() {
    this.context.logOut();
    }

But now i have to implement logout active directory user without going to Microsoft logout page.The Active Directory user logout with out going to logout page like below Image.

enter image description here

User logout not like above image.I don’t want to use the built in logout function.I have tried like below two different methods

           this.context.clearCacheForResource(this.userInfo.userName);
           this.context.clearCache();

But it’s not clear the user information. when i’m clear the cache of the browser it’s working.

Any Answer Appreciated.

Thanks in Advance……..!

Answer

Your methods only clear local the cache/storage , it won’t clear any session/cookie hold on azure ad, silent auth might be happening due to cookie is still there .If you want to clear that, then the built in logout should be the one to use.

Here is a similar thread and provides the workaround to implement the silent logout :

You could probably try to implement the silent logout(probably using iframe, this will prevent the ux from displaying), and then call clearCache to clear the localstorage/sessionstorage