SSO Login/Logout via Customised Header


#1

I am in the process of setting up Discourse as the forum element of an existing ASP.Net MVC site. It needs to offer as seamless a user experience as possible. I have got the SSO working and started adding a custom header and footer to mimic the existing site. So far so good.

However the existing site has the Login/Logout options in its own header section. Ideally I’d like this to log the user out of both sites whilst hiding the standard Discourse Logout. Is this possible? I was hoping I would be able to log off the main site and then Discourse in a similar manner to the way the log on works. I saw a couple of people asking for this in the (Official SSO thread) but it wasn’t implemented at that time.

What is the current status? Or is there another way to solve my problem?


(Lars) #2

I’d like to know this as well - I also would like a method for logging out on the main site, when you click logout on Discourse…

The “docs” state /admin/users/:user_id/logout logs out the user - but I don’t know the user_id (it’s not the external). I would like to be able to logout users with their external_id…


(Jeff Atwood) #3

What is our position on this @sam?


(Ashish Chandwani) #4

Sam replied in another thread:
https://meta.discourse.org/t/official-single-sign-on-for-discourse/13045/153?source_topic_id=23807

the login_redirect setting works for this as long as your parent site just kills the session for the logged in user. From there you can also propagate to your other web properties.


#5

This doesn’t answer the first question though, how do you have a custom link on the custom header for logging out?


(Sam Saffron) #6

You would need to implement an endpoint on your side for this that calls our API and logs out users.