0

I have tried these steps

Use the following steps to generate an access token:

Log in to Admin and click System > Extensions > Integrations to display the Integrations page.

Click Add New Integration to display the New Integration page.

Enter a unique name for the integration in the Name field. Then enter your admin password in the Your Password field. Leave all other fields blank.

Click the API tab. Select the Magento resources the integration can access. You can select all resources, or select a custom list.

Click Save to save your changes and return to the Integrations page.

Click the Activate link in the grid that corresponds to the newly-created integration.

Click Allow.

You can store this access token value in the system configuration and fetch it in code.

from another question Is it good to use Access Token in Magento 2 for REST API?

but seems it doesn't work when I try it in Postman. Eve if I give it all access.

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

Any idea what am I doing wrong?

Thanks!

1 Answer 1

1

In previous versions of Commerce, the access token could be used on its own for token-based authentication. This behavior has been disabled by default due to the security implications of a never-expiring access token. Namely, if the access token is compromised it provides undetected persistent access to a store

However, while it is not recommended, this behavior can be restored in the Admin by setting the Stores > Configuration > Services > OAuth > Consumer Settings > Allow OAuth Access Tokens to be used as standalone Bearer tokens option to Yes. You can also enable this setting from the CLI by running the following command:

bin/magento config:set oauth/consumer/enable_integration_as_bearer 1

then flush cache

Please see the official docs here: Token-based authentication

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.