我正在使用laravel 5.3为移动应用程序构建api和后端管理.我集成了Dingo/api包并使用Oauth2进行身份验证.我制作了一个API并使用postman登录:API url:mydomain/api/auth/login登录结果:
{"meta":{"message":"Success","status_code":1000,"status":true},"data":{"access_token":"BK81coQ8mnR7PrfEuYzOwKBuZukXgeVw2pcUjHcZ","token_type":"Bearer","expires_in ":604800,"refresh_token":"KRIB6YnvqT25rG1fGtoMrK9mGeB7m2J3cdj9QB8N","profile":{"id":1,"user_id":1,"name":"ThanhDN","postal_code":null,"phone_number":null," age":null,"gender":null,"address":null,"avatar":null,"status":null,"created_at":"2017-01-11 04:44:33","updated_at": "2017-01-11 04:44:33","deleted_at":null}}}
我使用access_token来调用API以获取用户信息API url:mydomain/api/user/1但是我收到了一个错误:
{"message":"SQLSTATE [42S22]:未找到列:1054'where子句'中的未知列'api_token'(SQL:select*from
users
whereapi_token
= 9mQmZqIjqnRamzX7syjtU6X1jGWrfQXndKKT97TU limit 1)","code":"42S22","status_code ":500,
我搜索过但看不到任何解决方案.请帮我解决一下.非常感谢你!!!
即使你调用logout url:mydomain/api/logout
确保您已['guards']['api']['driver']
设置为passport
中config/auth.php
,并更新了配置缓存:php artisan config:cache
.