magento2 - 如何在 magento 2 中使用 REST API 获取所有类别而无需任何登录名或令牌?
问题描述
使用 Admin Token 类别将出现在 rest API 中,但没有 token 对如何在 magento 2 中获取所有没有 token 的类别没有任何解决方案
解决方案
默认情况下,Magento 2 允许在没有身份验证的情况下访问少数端点,这些端点被声明为anonymous
资源。例如,V1/directory/currency
无需V1/directory/countries
任何身份验证即可访问。
但是,当用户需要访问非匿名端点时。此选项 ( Allow Anonymous Guest Access
) 必须启用:
Stores > Settings > Configuration > Services > Magento Web API > Web API Security > Allow Anonymous Guest Access
现在,可以使用此端点获得无需身份验证的类别。
http://example.com/rest/V1/categories
注意:不建议在没有身份验证的情况下使用 Magento 2 REST API。
推荐阅读
- ios - 将 Flutter App 的 iOS 部分连接到 Firebase 的困惑
- objective-c - Xcode 中具有原子/同步属性和 NSLock 的线程清理程序问题
- youtube - YouTube API v3 搜索未返回所有视频
- haskell - the recursion of custom data type
- python - 如何使用 tweepy 获取按分钟索引的上周 Twitter 推文数据的数据框?
- unique-ptr - CPP 指南:重置智能指针
- python - 将两列相乘时出现错误消息
- php - 在 minicart Magento 1.9 上显示折扣金额
- java - 在 android 上使用 openCV matchTemplate 速度大幅下降
- android - Android SQLite - 将图像存储在数据库中