When using an integration token to access Magento's REST API, you can authenticate requests by including the token in the Authorization header as a Bearer token. This allows the system to recognize the permissions assigned to the integration and grant access to the specified resources.
* Using the Access Token as Bearer Token:
* In Magento, integration tokens are treated as Bearer tokens for API authentication. Once the token is generated, you can directly use it in the Authorization header.
* The access token XXXXXX will provide access to resources allowed by the Magento_Customer::
customer permission.
* Why Option A is Correct:
* Option A shows the correct way to authenticate an API call using a pre-existing integration token by setting the header Authorization: Bearer XXXXXX. This is a straightforward way to search for customers without additional steps.
* Options B and C describe methods that are not necessary for this scenario. The access token already has the necessary permissions, so there's no need to re-authenticate or obtain an admin token.
* Example Command:
curl -X GET "https://magentourl/rest/V1/customers/search?searchCriteria[filterGroups][0][filters][0][field]
=email&searchCriteria[filterGroups][0][filters][0][value]
[email protected]" -H "Authorization:
Bearer XXXXXX"
References:
Adobe Commerce REST API documentation on Authentication
Magento Integration Tokens Guide on Using Tokens