# How to make customer login using API endpoint?

**URL:** <https://forum.shopware.com/t/how-to-make-customer-login-using-api-endpoint/99147>\
**Category:** Shopware 6 (English)\
**Created:** [29. März 2023 um 13:37 UTC](https://forum.shopware.com/t/how-to-make-customer-login-using-api-endpoint/99147 "2023-03-29T13:37:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tejas.parmar](https://avatars.discourse-cdn.com/v4/letter/t/90db22/32.png) [@tejas.parmar](https://forum.shopware.com/u/tejas.parmar)\
**Post date:** [29. März 2023 um 13:37 UTC](https://forum.shopware.com/t/how-to-make-customer-login-using-api-endpoint/99147/1 "2023-03-29T13:37:35Z")

</div>

I want to make the customer log in using the API endpoint.  
The login API just returns "ContextToken’ like this.  
API ENDPOINT : [http://local.shopware/store-api/account/login](http://local.shopware/store-api/account/login)  
Data :  
{  
„username“: „[tejas.parmar@rootinfosoll.com](mailto:tejas.parmar@rootinfosoll.com)“,  
„password“: „12345678“  
}

Response:  
{  
„apiAlias“: „array\_struct“,  
„contextToken“: „Hw4Cg0xqvtt2Z3xYD44yw3KyWMfXGIrz“,  
„redirectUrl“: null  
}

---

<div class="post-metadata">

**Author:** ![Max\_Shop](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Max\_Shop](https://forum.shopware.com/u/Max_Shop)\
**Post date:** [30. März 2023 um 13:03 UTC](https://forum.shopware.com/t/how-to-make-customer-login-using-api-endpoint/99147/2 "2023-03-30T13:03:54Z")

</div>

That is all. If you get a contextToken then the customer is logged in.

---

<div class="post-metadata">

**Author:** ![tejas.parmar](https://avatars.discourse-cdn.com/v4/letter/t/90db22/32.png) [@tejas.parmar](https://forum.shopware.com/u/tejas.parmar)\
**Post date:** [30. März 2023 um 18:42 UTC](https://forum.shopware.com/t/how-to-make-customer-login-using-api-endpoint/99147/3 "2023-03-30T18:42:34Z")

</div>

Thanks for Reply.  
Yes, that I understood, the customer is logged in.  
But this time I have login using the site’s login page.  
I want to make the customer login programmatically or through API.

---

<div class="post-metadata">

**Author:** ![Max\_Shop](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Max\_Shop](https://forum.shopware.com/u/Max_Shop)\
**Post date:** [31. März 2023 um 08:25 UTC](https://forum.shopware.com/t/how-to-make-customer-login-using-api-endpoint/99147/4 "2023-03-31T08:25:30Z")

</div>

It is the same. You use the email and password from the form and send it via api to the backend. Then you reload the page and the customer is logged in.

---

<div class="post-metadata">

**Author:** ![tejas.parmar](https://avatars.discourse-cdn.com/v4/letter/t/90db22/32.png) [@tejas.parmar](https://forum.shopware.com/u/tejas.parmar)\
**Post date:** [5. April 2023 um 11:14 UTC](https://forum.shopware.com/t/how-to-make-customer-login-using-api-endpoint/99147/5 "2023-04-05T11:14:36Z")

</div>

Ok. Thanks for your reply.  
I will try that thing.  
Is there any way by which we can programmatically make customers log in?
