【问题标题】:Laravel Passport Illegal offset typeLaravel Passport 非法偏移类型
【发布时间】:2019-03-08 20:49:16
【问题描述】:

我已经安装了 Laravel Passport,遵循了多个网站的所有说明,但我无法使其正常运行。

当我调用中间件 auth:api 时,我不断收到同样的错误。

ErrorException (E_WARNING)
Illegal offset type

AuthManager 类在这一行的守卫方法中发生的错误

public function guard($name = null)
{
    $name = $name ?: $this->getDefaultDriver();

    return $this->guards[$name] ?? $this->guards[$name] = $this->resolve($name);
}

【问题讨论】:

    标签: api laravel-passport laravel-5.7


    【解决方案1】:

    这可能意味着您没有正确配置auth 中间件。

    Passport 使用中间件 ['web', 'auth'] 定义了一些路由(这是 Laravel 的默认设置),因此请检查您是否在 Http/Kernel.php 上有它们。

    如果没有,你可以使用默认的中间件配置: https://github.com/laravel/laravel/blob/5.7/app/Http/Kernel.php#L54

    【讨论】:

    • 我就是这样的
    猜你喜欢
    • 2019-05-03
    • 2020-10-21
    • 2019-07-16
    • 2018-01-28
    • 1970-01-01
    • 2011-01-12
    • 2013-03-24
    • 2020-11-26
    • 2021-05-29
    相关资源
    最近更新 更多