I have tried the following, but I get Consumer is not authorized to access %resources" error. Is there something I'm missing? Can you suggest another way to retrieve sales?

curl -X POST "http://magento2.app/index.php/rest/V1/integration/admin/token"      -H "Content-Type:application/json"   -d '{"username":"admin", "password":"test1234"}

The token returned is: 5si930daobo3t529j8yq6xx3wp77x2vf I plug it in the next request:

curl -X GET -H "Authorization: Bearer  5si930daobo3t529j8yq6xx3wp77x2vf" -H "Cache-Control: no-cache" -H "Postman-Token: 366814d0-e058-7b89-c896-5670fb4fadb9" 'http://magento2.app/index.php/rest/V1/orders?criteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bfield%5D=status&criteria%5Bfilter_groups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bvalue%5D=processing'    

error message is returned:

{"message":"Consumer is not authorized to access %resources","parameters":{"resources":"Magento_Sales::sales"}}

Magento 2 Rest API: http://devdocs.magento.com/guides/v2.0/rest/restApi/restCollection/Magento/Sales/Service/V1/OrderList/orderList.html

Token-based authentication: http://devdocs.magento.com/guides/v2.0/get-started/authentication/gs-authentication-token.html


1 Answer 1


Try having only one space between 'Bearer' and the token. That worked for me (two spaces did not).


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.