# How to log in customer in controller without a use of his password in Shopware 5?

**URL:** https://forum.shopware.com/t/how-to-log-in-customer-in-controller-without-a-use-of-his-password-in-shopware-5/70080
**Category:** International (English Only)
**Created:** [7. Oktober 2020 um 09:52 UTC](https://forum.shopware.com/t/how-to-log-in-customer-in-controller-without-a-use-of-his-password-in-shopware-5/70080 "2020-10-07T09:52:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![davit\_sargsyan](https://avatars.discourse-cdn.com/v4/letter/d/7ba0ec/32.png) [@davit\_sargsyan](https://forum.shopware.com/u/davit_sargsyan)
#### Post date: [7. Oktober 2020 um 09:52 UTC](https://forum.shopware.com/t/how-to-log-in-customer-in-controller-without-a-use-of-his-password-in-shopware-5/70080/1 "2020-10-07T09:52:41Z")

</div>

For logout we use&nbsp;

Shopware()-\>Modules()-\>Admin()-\>logout();

And I know that I can use the&nbsp;Shopware()-\>Modules()-\>Admin()-\>sLogin(true); from the&nbsp;

private&nbsp;function&nbsp;loginCustomer(Customer&nbsp;$customer):&nbsp;void

&nbsp;&nbsp;&nbsp;&nbsp;{

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-\>front-\>Request()-\>setPost(‘email’,&nbsp;$customer-\>getEmail());

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this-\>front-\>Request()-\>setPost(‘passwordMD5’,&nbsp;$customer-\>getPassword());

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Shopware()-\>Modules()-\>Admin()-\>sLogin(true);

&nbsp;&nbsp;&nbsp;&nbsp;}

I want to know if I can use this or some other method for login of the customer after I logout the customer and don’t keep his password.

Is it possible to achieve this with having only the customer id?
