Mattermost loging out a user


#1

Good morning,

I was wondering if could exist the possibility (with some api or command) to log out a logged in user (I explain myself). I mean to log out all logged in sessions (at least the web logged ones) and that sessions would have been initiated by the user from, for instance, the https interface. Is not using the api for autologin and so… it’s just something like fetch a users logged in session or for instance, having the username, ask for immediate disconection or session destroy…

Is that possible?.

Best regards,


#2

Your best bet would be to deactivate and then reactivate the user, which you can do from the command line. Deactivating removes all active sessions and then reactivating will allow the user to log in normally. The commands would look like

$ cd <path to mattermost>
$ sudo bin/platform user deactivate username1 username2
$ sudo bin/platform user activate username1 username2

You can use user ids or email addresses instead of usernames, and you can multiple ones by separating them with spaces. More information can be found on the Mattermost command line documentation.