我已为我的模型'会员'(会员表)配置了护照身份验证。登录时创建的访问令牌完全正确。但是我无法在登录apis后进行身份验证。 我收到了以下错误
BadMethodCallException.Call to undefined method Illuminate\Database\Query\Builder::getAuthIdentifierName()
答案 0 :(得分:0)
我忘了在路线中放置auth:api中间件。
答案 1 :(得分:0)
请使用像
这样的身份验证中间件Route::group(array('middleware' => ['auth:api']), function() {
//your routes;
});
答案 2 :(得分:0)
Passport by default uses User model and here you are using Member table. Just check if you have included Model class inside the auth.php file inside config folder.
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\Member::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
Or try this https://github.com/santigarcor/laratrust/issues/134#issuecomment-300318982