Logout- from Okta when User logged out from Sitecore CMS

Hi Everyone,

I’m Bharath and a Sitecore developer.

I have implemented the OKTA Authentication for Sitecore Admin(CMS) Login. Based Roles and Groups defined on Sitecore and OKTA, the role transformation is happening, and authenticated user is getting logged into Sitecore CMS successfully.

Whenever a OKTA authenticated user is logout from Sitecore CMS and try to login again, now without providing user credentials, users getting logged in due to already set session.

Now my requirement is that, once OKTA authenticated user logged out from Sitecore, they supposed to logout from OKAT also.

Intern if OKTA authenticated user logout from Sitecore CMS and tries to login again then user supposed to authenticate again at OKTA end i.e. each time user must be authenticated.

I tried to google my issue, I found that I suppose to kill the session. I tried various method to end the session of Sitecore Logout User, but didn’t worked out.

It would be great and much appreciated If I could get some inputs or suggestion or guidance on my concern.

My implementation is purely based on Asp.Net. Kindly suggest any possible way on the same.

Hello,
Have you tried to implement something like the Logout() method from our sample?

Hello @erik,

Yes I tried Logout() method, by adding following code snippet into my method, that didn’t worked out for me.

if (HttpContext.User.Identity.IsAuthenticated)
{
HttpContext.GetOwinContext().Authentication.SignOut(
CookieAuthenticationDefaults.AuthenticationType,
OktaDefaults.MvcAuthenticationType);
}

Not sure if this will help, but see my post about logout below. After logging out of Sitecore, I think you can send the user to https://{oktaOrgUrl/login/signout?fromURI={sitecore main page}

1 Like

Hello @kevintparker ,

Thanks you so much. Your suggestion got worked out.

I had tried out a lots of things to make it happen, but I couldn’t make it.

Thanks once again.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.