v1.1.0: How to fix the issue when the login as customer function no more work?

Created by Support Agent, Modified on Mon, 20 Apr at 12:08 AM by Support Agent

QUESTION:


I can easily replicate it on 2.4.2 due to this observer xxxxx/xxxxx/module-login-as-customer-frontend-ui/Plugin/InvalidateExpiredSessionPlugin.php as you can see BSS & Magento have separate tables Magento is looking on its own table and it failed to find logged in user so it will regenerate session.


If you pass above observer to your engineers they should find it:

$adminId = $this->getLoggedAsCustomerAdminId->execute();

$customerId = (int)$this->session->getCustomerId();

if ($adminId && $customerId) {

if (!$this->isLoginAsCustomerSessionActive->execute($customerId, $adminId)) {

$this->session->clearStorage();

$this->session->expireSessionCookie();

$this->session->regenerateId();

}

}


Please give me the guide to fix this?


ANSWER:


From Magento 2.4.1, Magento default supports the function login as customer so that please download the files below and overrides the current files on your site to get it worked properly as Magento default logic instead of using our module logic.


+ app/code/Bss/AdminPreview/Block/Adminhtml/Customer/Edit/Login.php

+ app/code/Bss/AdminPreview/Controller/Adminhtml/Customer/Login.php
+ app/code/Bss/AdminPreview/Helper/Data.php
+ app/code/Bss/AdminPreview/Model/Login.php


If you need any further assistance, please feel free to contact us. We'd be happy to support!  


Get to know us!!


BSS Commerce is a full-service ecommerce agency with 14+ years of experience, supporting 75,000+ customers worldwide. As an Adobe Commerce Solution Bronze Partner and Select Magento Extensions Builder, we deliver trusted end-to-end solutions.


Our core strength is Magento, with 150+ extensions designed to enhance store performance and drive growth. With deep expertise from years of working on Magento websites, we deliver scalable, high-impact solutions backed by strong client trust.


Discover our extensions: https://bsscommerce.com/magento-2-extensions.html 


You can refer our top tier extensions:


If you need any further support, please feel free to contact us at sales@bsscommerce or via our support portal.



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article