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!