cancel
Showing results for 
Search instead for 
Did you mean: 

The consumer isn't authorized to access %resources with integration token

The consumer isn't authorized to access %resources with integration token

Hello all,

 

Good day,

 

In my magento 2.4.6 installation I have a custom module with below files:

 

acl.xml

 

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
    <acl>
        <resources>
             <resource id="Magento_Backend::admin"> 
                 <resource id="Magento_Sales::sales" title="Sales" translate="title" sortOrder="20"> 
                     <resource id="Magento_Sales::sales_operation" title="Operations" translate="title" sortOrder="10"> 
                         <resource id="Magento_Sales::sales_order"  title="Orders" translate="title" sortOrder="10"> 
                             <resource id="Magento_Sales::actions" title="Actions" translate="title" sortOrder="10"> 
                                 <resource id="Magento_Sales::actions_view" title="View" translate="title" sortOrder="20" /> 
                             </resource> 
                         </resource> 
                     </resource> 
                 </resource> 
             </resource> 
        </resources>
    </acl>
</config>

api.xml

 

<?xml version="1.0"?>
<integrations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Integration:etc/integration/api.xsd">
    <integration name="TestIntegration">
        <resources>
            <resource name="Magento_Sales::sales"/>
            <resource name="Magento_Sales::sales_operation"/>
            <resource name="Magento_Sales::actions"/>
            <resource name="Magento_Sales::sales_order"/>    
            <resource name="Magento_Sales::actions_view"/>
        </resources>
    </integration>
</integrations>

webapi.xml

 

<?xml version="1.0"?>
<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd">
    <route url="/V1/orders" method="GET">
        <service class="Magento\Sales\Api\OrderRepositoryInterface" method="getList"/>
        <resources>
            <resource ref="Magento_Sales::actions_view" />
        </resources>
    </route>
</routes>

I activate the integration, use the token in GET /V1/orders and receive 

 "message": "The consumer isn't authorized to access %resources.",
    "parameters": {
        "resources": "Magento_Sales::actions_view"
    },

Any help welcomed,

 

Many thanks