Programmatically log users out of discourse

Using SSO, it seems that when a user is deleted in Wordpress, they are not logged out of Discourse.

this is a problem for my setup as I want to stop users from accessing discourse when their subscription in Memberpress expires or they are removed from Memberpress/Wordpress.

I can prevent them from getting accessing when they log in using the hook “wpdc_sso_provider_before_sso_redirect”, and check if they have a valid subscription at this point, however the problem is that the discourse session lasts forever, so they are essentially never logged off.

How can I fix this?
Is there perhaps a way to log users out from discourse via an API call or something?

Thank you!!
Per

Maybe this section could be helpful.

1 Like