我安装了Laravel Passport,遵循多个网站的所有说明,但我无法正常运行。
当我打电话给中间件auth:api我继续得到同样的错误。
ErrorException (E_WARNING)
Illegal offset type
此行中的Guard方法上的AuthManager类中发生的错误
public function guard($name = null)
{
$name = $name ?: $this->getDefaultDriver();
return $this->guards[$name] ?? $this->guards[$name] = $this->resolve($name);
}
这可能意味着您没有正确配置auth
中间件。
Passport使用中间件['web', 'auth']
(这是Laravel的默认设置)定义了一些路由,因此请检查Http/Kernel.php
上是否有它们。
如果没有,您可以使用默认的中间件配置:https://github.com/laravel/laravel/blob/5.7/app/Http/Kernel.php#L54