# \[SOLVED\] Login to Mattermost from browser by skipping the login form

**URL:** <https://forum.mattermost.com/t/solved-login-to-mattermost-from-browser-by-skipping-the-login-form/3468>\
**Category:** Troubleshooting\
**Created:** [July 2, 2017, 5:28am UTC](https://forum.mattermost.com/t/solved-login-to-mattermost-from-browser-by-skipping-the-login-form/3468 "2017-07-02T05:28:44Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![JH635](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@JH635](https://forum.mattermost.com/u/JH635)\
**Post date:** [July 2, 2017, 5:28am UTC](https://forum.mattermost.com/t/solved-login-to-mattermost-from-browser-by-skipping-the-login-form/3468/1 "2017-07-02T05:28:44Z")

</div>

Is there a way to login to mattermost from a browser without writing the credentials directly in the login form?  
Something like [http://192.168.1.1/login/user=myusername&password=mypassword](http://192.168.1.1/login/user=myusername&password=mypassword) ?  
It can be great to allow some temporary users to join the chat without the need to remember the password.

REST API not helping here because after a login, I should set the cookie with a token manualy.

Thank you

---

<div class="post-metadata">

**Author:** ![prixone](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/prixone/32/1184_2.png) [@prixone](https://forum.mattermost.com/u/prixone)\
**Post date:** [July 2, 2017, 11:20pm UTC](https://forum.mattermost.com/t/solved-login-to-mattermost-from-browser-by-skipping-the-login-form/3468/2 "2017-07-02T23:20:55Z")

</div>

Acquire the token using the API and then set it directly to the user browser with your code, in PHP for example:

```php
setcookie($key, $value, time()+60*60*24*30, '/', '.yourdomain.com', true, true);

```

And the cookie will remain for the period set on the config, I think 30 days by default.

Then you can simple redirect the user to your mattermost, for example, in PHP:

```php
header("Location: https://chat.yourdomain.com/teamname/channels/town-square", true, 302);
exit;

```

All the above can be done programmatically, nothing needs to be done manually.

---

<div class="post-metadata">

**Author:** ![JH635](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@JH635](https://forum.mattermost.com/u/JH635)\
**Post date:** [July 3, 2017, 5:51am UTC](https://forum.mattermost.com/t/solved-login-to-mattermost-from-browser-by-skipping-the-login-form/3468/3 "2017-07-03T05:51:06Z")

</div>

Great idea, thank you @prixone.

---

<div class="post-metadata">

**Author:** ![prixone](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/prixone/32/1184_2.png) [@prixone](https://forum.mattermost.com/u/prixone)\
**Post date:** [July 3, 2017, 8:10pm UTC](https://forum.mattermost.com/t/solved-login-to-mattermost-from-browser-by-skipping-the-login-form/3468/4 "2017-07-03T20:10:29Z")

</div>

Let us know if that works for your needs so we can mark this as solved, thanks 😉

---

<div class="post-metadata">

**Author:** ![JH635](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@JH635](https://forum.mattermost.com/u/JH635)\
**Post date:** [July 5, 2017, 10:47am UTC](https://forum.mattermost.com/t/solved-login-to-mattermost-from-browser-by-skipping-the-login-form/3468/5 "2017-07-05T10:47:13Z")

</div>

Please mark it as solved 🙂

---

<div class="post-metadata">

**Author:** ![bje](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@bje](https://forum.mattermost.com/u/bje)\
**Post date:** [July 5, 2018, 1:15am UTC](https://forum.mattermost.com/t/solved-login-to-mattermost-from-browser-by-skipping-the-login-form/3468/6 "2018-07-05T01:15:13Z")

</div>

hi @prixone  
i have some question…

if i use API for authentication(login), can i use API without password?

and, I’m wondering that i want to decrypt user password if i access database

so, what is method of encryption for user password

if you mind, let me know that how to fix it

---

<div class="post-metadata">

**Author:** ![pacoeu](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@pacoeu](https://forum.mattermost.com/u/pacoeu)\
**Post date:** [July 18, 2018, 10:43pm UTC](https://forum.mattermost.com/t/solved-login-to-mattermost-from-browser-by-skipping-the-login-form/3468/7 "2018-07-18T22:43:52Z")

</div>

You post:  
setcookie($key, $value, time()+60_60_24\*30, ‘/’, ‘.yourdomain.com’, true, true);

I suppose the $value is the token created, but what do I have to write for $key?

Thanks
