# C# MVC Saml2 not clear idp user token after sign out

**URL:** <https://devforum.okta.com/t/c-mvc-saml2-not-clear-idp-user-token-after-sign-out/3250>\
**Category:** SAML\
**Created:** [November 1, 2018, 9:30am UTC](https://devforum.okta.com/t/c-mvc-saml2-not-clear-idp-user-token-after-sign-out/3250 "2018-11-01T09:30:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zheng](https://avatars.discourse-cdn.com/v4/letter/z/c67d28/32.png) [@zheng](https://devforum.okta.com/u/zheng)\
**Post date:** [November 1, 2018, 9:30am UTC](https://devforum.okta.com/t/c-mvc-saml2-not-clear-idp-user-token-after-sign-out/3250/1 "2018-11-01T09:30:32Z")

</div>

I am using Sustainsys.Saml2.Owin to implement SSO login.  
when I logout,It can’t open login page,but relogin my app.  
can I clear idp saml2 user session token after sign out  
like below  
Claim userClaim =ClaimsPrincipal.Current.FindFirst(“[http://schemas.microsoft.com/identity/claims/objectidentifier](http://schemas.microsoft.com/identity/claims/objectidentifier)”);  
if (userClaim != null)  
{  
string userObjectID = userClaim.Value;  
AuthenticationContext authContext = new AuthenticationContext(authority, new NaiveSessionCache(userObjectID));  
authContext.TokenCache.Clear();  
}

---

<div class="post-metadata">

**Author:** ![andrea](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/andrea/32/2172_2.png) [@andrea](https://devforum.okta.com/u/andrea)\
**Post date:** [February 12, 2024, 9:09pm UTC](https://devforum.okta.com/t/c-mvc-saml2-not-clear-idp-user-token-after-sign-out/3250/2 "2024-02-12T21:09:26Z")

</div>

Closed on February 12, 2024, 9:09pm UTC


