2

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?

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/…
    – B00MER
    Mar 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.
    – CarComp
    Sep 6, 2019 at 12:21

2 Answers 2

4

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.

2
  • Is their any other possibility to get the customer password @Ryan Hoerr Mar 19, 2018 at 13:45
  • 1
    The 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
2

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.

2
  • 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 :)
    – CodeGenius
    Apr 6, 2018 at 12:09

Your Answer

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

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