I would like to know if its possible to get a customer token or login as a customer through the REST API in Magento 2?
I know there is a feature in admin to login as a customer, but the question is if this feature is also available from the REST API?
So basically, I have an admin user token. And with this token I would like to create a customer token.
1 Answer 1
According to the documentation, if you have the customer login credentials you can do it by calling this endpoint:
POST /V1/integration/customer/token
{"username":"<USER-NAME>;", "password":"<PASSWORD>"}
If you don’t have the credentials but wish to impersonate the customer through the API, you may need to develop a new endpoint which can authenticate an admin user and then use the Magento\Integration\Model\Oauth\TokenFactory to create a customer token for the requested customer.