“调用成员函数forceFill()为null时”调用$ user-> createToken('Foo')-> accessToken时出错

时间:2018-11-02 12:52:25

标签: laravel-5.6 laravel-passport

Laravel 5.6.39 LARAVEL护照 这个错误每天只在生产服务器上发生,大约每天15-20次。用户每次尝试登录时都不会间歇性地发生这种情况。 我的代码:

  $user = Auth::user();
    $accessToken=$user->createToken('MyApp')->accessToken;

以下错误

{
"message": "Call to a member function forceFill() on null",
"exception": "Symfony\Component\Debug\Exception\FatalThrowableError",
"file": "/var/app/current/vendor/laravel/passport/src/PersonalAccessTokenFactory.php",
"line": 75,
"trace": [
{
"file": "/var/app/current/vendor/laravel/framework/src/Illuminate/Support/helpers.php",
"line": 1041,
"function": "Laravel\Passport{closure}",
"class": "Laravel\Passport\PersonalAccessTokenFactory",
"type": "->"
},
{
"file": "/var/app/current/vendor/laravel/passport/src/PersonalAccessTokenFactory.php",
"line": 79,
"function": "tap"
}

0 个答案:

没有答案