# Customer Login not working after 7 Days

**URL:** <https://forum.shopware.com/t/customer-login-not-working-after-7-days/103788>\
**Category:** Shopware 6 (English)\
**Created:** [22. April 2024 um 07:53 UTC](https://forum.shopware.com/t/customer-login-not-working-after-7-days/103788 "2024-04-22T07:53:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![alka1992](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@alka1992](https://forum.shopware.com/u/alka1992)\
**Post date:** [22. April 2024 um 07:53 UTC](https://forum.shopware.com/t/customer-login-not-working-after-7-days/103788/1 "2024-04-22T07:53:59Z")

</div>

I have the following problem: when a customer tries to log in to the shop after 7 days (Shopware 6), they are automatically redirected to the registration page, and no errors are displayed (neither in the Symfony Profiler nor in the devlog). After searching in the system files, I was able to throw an exception in the logs:

```auto
An exception was thrown during the handling of a request. {"exception":"[object] (Shopware\\Core\\Checkout\\Cart\\Exception\\CustomerNotLoggedInException(code: 0): Customer is not logged in. at /var/www/html/vendor/shopware/core/Checkout/Cart/CartException.php:69)"}

```

There, it validates whether a customer exists in the SalesChannelContext, and if not, the error is thrown. However, I don’t understand why there is no customer present.

I am not using Redis. When I create a new customer, I can log in with it for a week without any problems. I have already tried deleting the cookies in the browser, and even when I clear the caches, nothing changes. I suspect that the session is being stored somewhere and becomes invalid after a week, but no (or faulty) new session is generated.

I have also checked the server’s php.ini and the session\_save\_path specified there, but there are no settings/files that invalidate the session after 7 days.

---

<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:** [22. April 2024 um 08:01 UTC](https://forum.shopware.com/t/customer-login-not-working-after-7-days/103788/2 "2024-04-22T08:01:51Z")

</div>

> [@alka1992](#):
>
> `CartException.php`

Since it is a cart exception I guess your cards get deleted after one week. If you try to load the stored cart from the cookie value then this fails.

Does the login not work after 7 days or has the customer just to login again? That is a huge difference.

---

<div class="post-metadata">

**Author:** ![alka1992](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@alka1992](https://forum.shopware.com/u/alka1992)\
**Post date:** [22. April 2024 um 08:08 UTC](https://forum.shopware.com/t/customer-login-not-working-after-7-days/103788/3 "2024-04-22T08:08:49Z")

</div>

If the customer attempts to log in 7 days after registration, the error occurs. It doesn’t matter if the customer logged in multiple times during those 7 days or not. The error always occurs 7 days after the initial registration, even if the customer had nothing in their cart.

---

<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:** [22. April 2024 um 08:11 UTC](https://forum.shopware.com/t/customer-login-not-working-after-7-days/103788/4 "2024-04-22T08:11:22Z")

</div>

Can it be a third party plugin? I have never seen that exception in the error.log.

---

<div class="post-metadata">

**Author:** ![alka1992](https://avatars.discourse-cdn.com/v4/letter/a/f0a364/32.png) [@alka1992](https://forum.shopware.com/u/alka1992)\
**Post date:** [22. April 2024 um 08:20 UTC](https://forum.shopware.com/t/customer-login-not-working-after-7-days/103788/5 "2024-04-22T08:20:50Z")

</div>

It seems like the error originates from `vendor/shopware/core/Framework/Routing/SalesChannelRequestContextResolver.php` , where `$this->validateLogin($request, $context)` is used to validate the request and session. In this function, an exception is thrown.

If the error is originating from `vendor/shopware/core/Framework/Routing/SalesChannelRequestContextResolver.php` , it’s likely within the core of Shopware rather than being caused by a plugin or am i understanding something wrong?

I createt an eventListener to get this error in the logs, bevore this there was no indicator for any error (only the loading of the registartion page)

---

<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:** [22. April 2024 um 13:14 UTC](https://forum.shopware.com/t/customer-login-not-working-after-7-days/103788/6 "2024-04-22T13:14:18Z")

</div>

If it is a bug, then you can create an issue ticket to get it fixed:

> **[Shopware Issuetracker](https://issues.shopware.com/?products=SW-6&edition=community,professionalEdition,enterpriseEdition,shopwareRise,shopwareEvolve,shopwareBeyond&projects=all&type=1,4&status=open,inProgress,done)**
>
> Shopware Issuetracker
