Hello Magento Folks,
Today We will discuss How to Get Admin User Data in Observer in Magento 2. Learn How to Add New Product Type in Magento 2 in our last published blog.
Magento allows for building events and observers. It is one type of Magento class where the created observer helps in identifying the performance, general behavior and to improve your business logic. Here, we will help you to get admin user data in the observer.
Steps to get admin user data in observer:
Step 1: Create events.xml file in your module at the below-given path:
Step 2: Now create an observer file at the below path.
Now go to your Backend and try to login with your username and password, and navigate to your var/log directory you can see
backend_auth_user_login_success.log file there with your user content.
Any doubts in the above method can be mentioned in the Comments section below.