# Automatic Login of User

**URL:** https://forum.mattermost.com/t/automatic-login-of-user/17630
**Category:** Uncategorized
**Created:** [December 29, 2023, 5:33pm UTC](https://forum.mattermost.com/t/automatic-login-of-user/17630 "2023-12-29T17:33:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![IrishRent](https://avatars.discourse-cdn.com/v4/letter/i/a183cd/32.png) [@IrishRent](https://forum.mattermost.com/u/IrishRent)
#### Post date: [December 29, 2023, 5:33pm UTC](https://forum.mattermost.com/t/automatic-login-of-user/17630/1 "2023-12-29T17:33:15Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Anil55](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@Anil55](https://forum.mattermost.com/u/Anil55)
#### Post date: [January 6, 2024, 12:30pm UTC](https://forum.mattermost.com/t/automatic-login-of-user/17630/2 "2024-01-06T12:30:10Z")

</div>

- 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.

---

<div class="post-metadata">

### Author: ![uptoamir](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/uptoamir/32/8735_2.png) [@uptoamir](https://forum.mattermost.com/u/uptoamir)
#### Post date: [February 22, 2025, 2:33am UTC](https://forum.mattermost.com/t/automatic-login-of-user/17630/3 "2025-02-22T02:33:09Z")

</div>

Same here man, not auto logging in
