0

I am developing a webapi for my custom module. I referred the below article and able to create the basic webapi that will accept arguments from the URL and do some processing.

http://alankent.me/2015/07/24/creating-a-new-rest-web-service-in-magento-2/

This is the API i constructed for my module

http://example.com/index.php/rest/V1/mymodule/arg1/arg2

I want to now implement the authorization. In other words the webapi should work only along with the Authorization bearer token.

How can I do that?

1 Answer 1

2

Got the answer after few minutes of posting this question.... Magento looks complex but more and more we do I feel its very easy...

<resources>
  <resource ref="Magento_Customer::group"/>
</resources>

After I set the above in webapi.xml, now this API can be accessed only whoever having the appropriate permissions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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