Magento – Magento 2 Rest API: Generate Auth Token for guest user

magento2rest

I need to generate authentication Token for guest user. I have checked in documentation, we can only generate Auth Token for customer and admin. Other resource can be accessed using anonymous role.

But as per application logic we are developing, It is require to save some user specific values to provide data.

Best Answer

The Magento web API framework allows guest users to access resources that are configured with the permission level of anonymous. Guest users are users who the framework cannot authenticate through existing authentication mechanisms. As a guest user, you do not need to, but you can, specify a token in a web API call for a resource with anonymous permission.

Refer this link for more details - http://devdocs.magento.com/guides/v2.0/rest/anonymous-api-security.html

Note : On a conclusion we can not generate authentication token for guest user as it have anonymous role. if you still want to save user specific information then override customer restApi model file and create your custom function for that.