Mattermost Peer-to-Peer Forum

Integrate mattermost in a django project with existing users by setting mmauthtoken cookies


I wanted to integrate mattermost in my existing django web project and trying to login by using separate database table for username and password for mattermost that maps to my project users.
I am using the python driver for mattermost and trying use a single login system for better user experience but I unable to set the cookies. I have found different post regarding this using custom oauth and Login to Mattermost from browser by skipping the login form but was not able to follow the instructions.


Hi @dejavu88,

There are two cookies that need set to login without a password and username. Here’s an example of how to set them:

setcookie('MMUSERID', '<user id from database>', time()+606024*30, ‘/’, ‘’, true, true);
setcookie('MMAUTHTOKEN', '<Authentication Token Value>', time()+606024*30, ‘/’, ‘’, true, true);

Replace <user id from database> and <Authentication Token Value> with their respective values for that user. You can get both of these values with a database query, or by using the authentication instructions for the Mattermost API. Is this what you’re looking for?


@amy.blais thanks !! This is what I was looking for.