Is it possible to connect a user on his browser via an API call?

Hello Alexander, and thanks for your answer!

So basically I have a form that ask the user to input a username and a password, if the form is valid I create the account and add it to my Mattermost Server but the user needs to login manually. I want to login the user with the API right after the account creation to make the process seamless. I think that I need to get the token via the login endpoint and then create the cookie with it to achieve that?

I’m using the python MattermMost driver as my website is developped in Django but everything I tried didn’t seem to work. I saw your other post where you wrote a curl example and tried to replicate it but only got this error :

<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>

I also tried it with the python driver but I got nothing :

payload = {"login_id": username, "password": password}
r = driver.users.login_user(payload)
print(r)
>>> None

I don’t know what i’m doing wrong here…

I’m using MatterMost Gitlab if that matters.

UPDATE :
Ok that’s my bad, I forgot to add the https:// at the beginning in the curl request, also I found that the python driver work well but doesn’t return anything… ? Anyway i’ll find a way to get the token, but i’m still wondering what I should do with it

UPDATE 2 :
I managed to get the token via requests but now I don’t know what to do with it, i saw that there’s a cookie named MMAUTHTOKEN but that’s my only idea