Logging off users
You can use the POST admin endpoint /admin/users/{USER_ID}/log_out to log out any user in the system if needed.
To configure the endpoint Discourse redirects to on logout search for the logout redirect setting. If no URL has been set here you will be redirected back to the URL configured in discourse connect url .
I’ve created an API key to accomplish this, then made a POST request using https://reqbin.com/ to https://MY_DISCOURSE_DOMAIN/admin/users/USER_ID/log_out?api_key=XXXXXXXXXXXXXXXXXXXXXX&api_username=system
For my API key, I allowed system to be my user. If anyone could give me some guidance as to why this isn’t working, it would be greatly appreciated.
I’ve figured it out, so I will leave the link to the other forum here so others like me can have an easier time trying to implement this. It turns out that the other topics that suggest you put your api_key and api_username in the URL were invalidated about half a year ago. The new way to make the POST request is to follow the steps in the following forum.
In my case, I logged someone out by making the following curl request: