Yii2 Restful Api 401

采用Yii2 Restful Api方式为APP提供数据,默认你已经做好了所有的编码和配置工作。采用Postman测试接口:

出现这个画面的一个可能原因是:access_token的写法有误,如果你使用的是下边配置的话,请把access_token

改为access-token,即http://api.yingxiang.com/v1/users?access-token=123,原因在于QueryParamAuth这个类接收的就是access-token,不信自己点进去看。

原文地址:https://www.cnblogs.com/peteremperor/p/6816427.html