How can I get the customer's password in plain text/raw format if the customer as already registered and logged in in Magento 2?
-
You can't unless you are capturing the password in plaintext upon login during the hashed comparison from the plain text version customer has entered on login, but is NOT wise to do as the passwords are one way encrypted for security purposes: magento.stackexchange.com/questions/137555/…– B00MERMar 19, 2018 at 13:42
-
I can see the purpose of this... I need to do the same thing, in order to pass the user's password into our CRM system to get SSO to work.– CarCompSep 6, 2019 at 12:21
2 Answers
You cannot get the customer's plain text password after they have registered and logged in. That would be a huge security problem.
You should rethink whatever you have in mind and find a way to do it that doesn't require the password.
-
Is their any other possibility to get the customer password @Ryan Hoerr Mar 19, 2018 at 13:45
-
1The only way is to capture it next time they log in. When they log in, and if it's successful you should have the plain text password available in the POST request to do what you want with. Mar 19, 2018 at 14:07
Magento 2 keep SHA2
encrypted password in customer_entity
table, if you still need to get password of customer after he is logged in, you can make an observer and get password in $request
params.
If you define your problem in detail, there are some better ways to handle such scenarios.
you can refer to this link for further details how passwords are saved in magento.
-
In M y case i need to get the customer username and password once the user registered in site.@Umar Mar 20, 2018 at 4:22
-
@PranayK you can write observer for customer_register_success event and get request params there. In request params you can fetch user password & email. You can easily use request class parameter
\Magento\Framework\App\RequestInterface $request
in observer's constructor and use the request object to get password. Mark this answer as accepted if it solves your issue :) Apr 6, 2018 at 12:09