Automatic Login of User

Hi,
I would like to allow admin user to be able to go to Mattermost, without needing to log in manually.
I am trying to do this by logging in the user by calling /api/v4/users/login using login_id and password via command line, and getting the Id, Token in the header. In my application, I then set these 2 cookies:

MMUSERID cookie, with path of /, expires in 30 days, secure: true, httponly: true and the value of id.
MMAUTHTOKEN cookie, with path of /, expires in 30 days, secure: true, httponly: true and the value of token.

When I reload the browser page, it still goes to login page.
What step am I missing?

1 Like
  • Ensure that the Mattermost API /api/v4/users/login call is providing valid tokens and IDs.
  • Verify that the cookies are being set correctly with the precise cookie names (MMUSERID and MMAUTHTOKEN).
  • Confirm that the browser accepts and sends these cookies back to the Mattermost domain on subsequent requests.
  • Check if there are any specific session management or security configurations in Mattermost that might interfere with automated logins.
  • If applicable, consider using an authentication mechanism (like OAuth) to obtain tokens for programmatic access instead of manual login.