In magento 1 We are using admin session like this

$user = Mage::getSingleton('admin/session'); 
$userId = $user->getUser()->getUserId();
$userEmail = $user->getUser()->getEmail();
$userFirstname = $user->getUser()->getFirstname();
$userLastname = $user->getUser()->getLastname();

In magento 2 how can i get this detail ?

1 Answer 1


You can get admin detail like this:

public function __construct(
    \Magento\Backend\Model\Auth\Session $authSession,
) {
    $this->_authSession = $authSession;

write this code where you want admin detail

$auth = $this->_authSession;


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.