SSO - Cannot Log Out

AI-generated summary

In a discussion titled “SSO - Cannot Log Out” under the WordPress category, TimJensen reports that while SSO login via WordPress works, logging out of Discourse fails — users are automatically re-logged in after page refresh. He notes the SSO request lacks distinguishing parameters for logout. simon explains this occurs if “login required” is enabled and advises setting Discourse’s “logout redirect” to a WordPress logout URL (e.g., https://example.com/?request=logout) to ensure users are logged out of both systems. TimJensen confirms this solution resolved the issue.

I have set up SSO, using WordPress as the provider. The log in process works as expected; however, the log out process does not work. When I click “Log Out” from the Discourse menu I do see a modal confirming logout, but then I am automatically logged back in when the page refreshes. Is there a way to fix this so that clicking “Log Out” actually logs the user out of Discourse?

Related: The authentication request that Discourse makes to WordPress only has sso and sig args, so there’s no way for me to check on the provider side if the request is a logout request since the signature looks identical to a login request.

This will happen if the login required setting is enabled on your Discourse site. To get users logged out of Discourse, they also need to be logged out of the WordPress site. To log users out of WordPress, set the Discourse logout redirect site setting to https://example.com/?request=logout, with your domain name substituted for example.com.

Perfect! Adding the logout redirect was exactly what I was looking for. Thanks!