Endpoint
POST http://<host>/rest/default/V1/integration/admin/token
Header
Content-Type application/json
Payload
{
"username": "admin",
"password": "123123q"
}
Response
Magento returns the admin’s access token.
- This token must be specified in the authorization header of every
call that requires admin permissions.
Magento is using resource Magento_Customer::customer
for this and because of this we can't access it using Customer's token so for the same we need to override Specific API with OR you need to use Admin's token
<resource ref="self" />
And using this we can access all data of a specific customer using customer's Token in Magento API.
OR you need to use Admin token instead of customer token
- and if you want to use customer token then you need to change
webapi.xml
resource
For an example : Customer data
<!-- Customer Account -->
<route url="/V1/customers/:customerId" method="GET">
<service class="Magento\Customer\Api\CustomerRepositoryInterface" method="getById"/>
<resources>
<resource ref="self"/>
</resources>
</route>
I replaced resource <resource ref="Magento_Customer::customer"/>
to
<resource ref="self"/>
Magento_Customer::customer
for this and because of this we can't access it using Customer's token so for the same we need to override Specific API with OR Use Admin token for the same.