cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.4 the consumer isnt authorized to access %resources - customer group list via API

Magento 2.4 the consumer isnt authorized to access %resources - customer group list via API

I am trying to return a list of customer groups via the API. 

 

I have created an integration, I have run the following

curl -X GET "https://myIP/rest/all/V1/customerGroups/0" -H "accept: application/json" -H "accept: application/json" -H "Content-Type: application/json" -d "{ \"group\": { \"id\": 0, \"code\": \"string\", \"tax_class_id\": 0, \"tax_class_name\": \"string\", \"extension_attributes\": {} }}" "Authorization: Bearer MY API KEY"

And all I keep getting is 

{"message":"The consumer isn't authorized to access %resources.","parameters":{"resources":"Magento_Customer::group"}}curl: (3) Port number ended with ' '

 

A company integrating with my software is facing the same issue. I am at my wits end!

2 REPLIES 2

Re: Magento 2.4 the consumer isnt authorized to access %resources - customer group list via API

Hello @scibot 

 

I am assuming that you are passing 

Authorization: Bearer "MY API KEY"

here MY API KEY is actually a token which you will get from admin API which you can take reference from here :

https://devdocs.magento.com/guides/v2.3/rest/tutorials/prerequisite-tasks/create-admin-token.html

Make sure the account you are using for admin token has ACL to access this API, or use administrator account.

 

Let us know if still facing issue.

Problem Solved ? Click on 'Kudos' & Accept as Solution ! Smiley Happy

Re: Magento 2.4 the consumer isnt authorized to access %resources - customer group list via API

I am passing the token created in the integrations section of the Admin,
which has been given “full” access. Not really too keen on putting my API
key online on a public forum.

So is that not the right way to go about getting access via the API?

I’m just trying to get a list of customer groups for an integration we use.