Magento 2: I want to get admin or customer token via Rest API. Early I used:
End point POST / rest / <store_code> / V1 / integration / admin(or customer) / token
Headings Content-Type / json app
Payload { "username": "admin", "password": "123123q" }
But now this method doesn't work. Can anyone please help me?
1 Answer 1
try below API
Use Content-Type - application/json
Create Customer Token
http://127.0.0.1/rest/store_code/V1/integration/customer/token
Body
{
"username": "[email protected]",
"password": "xxxxxxx"
}
Create Admin token
http://127.0.0.1/rest/store_code/V1/integration/admin/token
Body
{
"username": "admin",
"password": "xxxxxxx"
}
Make sure username and password are correct or not and store code also.
For checking store code go to store > all stores
-
Thanks for your reply. But I used a similar method. And it doesn't work, although it worked without problems before. I am guessing that something may have changed in the Magento 2 API. Could you confirm that this method works at the moment?Ihor Radzyil– Ihor Radzyil2021年07月10日 10:29:48 +00:00Commented Jul 10, 2021 at 10:29