Rest API - The consumer isn't authorized to access %resources
I have written a script to make use of Magento Bulk Endpoints in order to quickly and efficiently import hundreds and potentially thousands of products into magento.
The first part is to get the authorisation token that will then be passed to the "/async/bulk/V1/products" magento endpoint rest service for the "Authorization Bearer" param.
So from my script, when making a CURL request to the "rest/V1/integration/admin/token" magento endpoint rest service to get the token, I pass my admin user (username, password) as params. My users USER Role has ALL privileges, so that is not the issue.
This successfully returns a token.
What seems to happen then is after this, magento then delegates to Magento\WebapiAsync\Controller\Rest\Asynchronous\InputParamsResolver - resolve()
then this line is run: $this->requestValidator->validate();
which calls: Magento\Webapi\Controller\Rest\RequestValidator - validate()
which then calls Magento\Webapi\Controller\Rest\RequestValidator - checkPermissions()
and this fails giving error "The consumer isn't authorized to access %resources" and therefore rendering the token request inoperable
Back in the file Magento\WebapiAsync\Controller\Rest\Asynchronous\InputParamsResolver - resolve()
If I comment out the call to validate, it works $this->requestValidator->validate();
Of course I know this is bad and I wouldnt do that. But why would this fail using the correct admin user (username, password)