I've created REST API in Magento2 but everyone can use it. How can I add basic auth to my API?


You need to add: <resource ref="anonymous" />

For example:


<route url="/V1/search" method="GET">
    <service class="Magento\Search\Api\SearchInterface" method="search"/>
        <resource ref="anonymous" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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