I'm using laravel 5.3 to build api and backend management for mobile app. I'm integrated Dingo/api package and use Oauth2 for authenticate. I made an API and login with postman: API url: mydomain/api/auth/login Logged in result:
{ "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 } } }
I used access_token to call API for get user information API url: mydomain/api/user/1 But I got an error:
{"message":"SQLSTATE[42S22]: Column not found: 1054 Unknown column 'api_token' in 'where clause' (SQL: select * from
users
whereapi_token
= 9mQmZqIjqnRamzX7syjtU6X1jGWrfQXndKKT97TU limit 1)","code":"42S22","status_code":500,
I've searched but could not see any solution. Please help me resolve it. Thank you very much!!!
And even when you call logout url: mydomain/api/logout
Make sure you have ['guards']['api']['driver']
set to passport
in config/auth.php
, and updated the configuration cache: php artisan config:cache
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With