0

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.

asked Jul 15, 2022 at 14:53
0

1 Answer 1

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.

answered Jul 15, 2022 at 20:57

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.