I would like to use the Rest API to get a client token first.
And then use this token to login as Magento2 client.
E.g. domain.com? customerToken = xyz
Are there any ready-made methods / modules for this in Magento2? I can probably call the magento rest api from the magento module (call the rest api from magento itself) to verify token is correct, but there is probably some other better solution?
1 Answer 1
You can try Login API:
integrationCustomerTokenServiceV1:
Interface providing token generation for Customers
POST /V1/integration/customer/token
API URL: {baseurl}/rest/V1/integration/customer/token
Method: POST
Body:
{
"username": "[email protected]",
"password": "Test@123"
}
Response:
"bdw1x6cb3ntbdj6d4pqfzr8xksjezkv2"
Reference : https://devdocs.magento.com/guides/v2.4/get-started/authentication/gs-authentication-token.html