Tuesday, August 23, 2022

[FIXED] How to get all categories using REST API without any login or token in magento 2?

Issue

Using Admin Token categories will comes in rest API but without token not working any solution on to how to get all categories without token in magento 2


Solution

By default, Magento 2 allows access without authentication for few endpoints, which are declared as anonymous resources. For example, V1/directory/currency and V1/directory/countries can be accessed without any authentication.

But, When Users need to access to non-anonymous endpoints. This option (Allow Anonymous Guest Access) must be enabled:

Stores > Settings > Configuration > Services > Magento Web API > Web API Security > Allow Anonymous Guest Access

Now, It is possible to get the categories without authentication by using this endpoint.

http://example.com/rest/V1/categories

Note: It is not recommended to use Magento 2 REST API without authentication.



Answered By - Milan Chandro
Answer Checked By - Pedro (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.