小编Arr*_*ous的帖子

$request->user() 在 Laravel 5.5 中返回 null

我在从 Illuminate 请求 ($request->user()) 中获取用户时遇到问题。

 $request->user() // whatever i do this keeps returning null
Run Code Online (Sandbox Code Playgroud)

PusherBroadcastDriver 使用这个,我无法编辑第三方代码,原因很明显..

我正在使用 Tymon\JWT 生成令牌并使用我的应用程序验证用户。我目前尝试执行以下操作(检查代码)

认证服务提供商:

public function boot()
{
    $this->registerPolicies();

    Auth::extend('jwt', function ($app, $name, array $config) {
        return new JWTGuard($app['tymon.jwt'],
            Auth::createUserProvider($config['provider']),
            $app['request']);
    });

}
Run Code Online (Sandbox Code Playgroud)

中间件:

 public class JWTRefreshMiddleware extends RefreshToken
{
/**
 * Handle an incoming request.
 *
 * @param  \Illuminate\Http\Request $request
 * @param  \Closure $next
 *
 * @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException
 *
 * @return mixed
 */
public function handle($request, Closure $next)
{
    $response = parent::handle($request, $next); …
Run Code Online (Sandbox Code Playgroud)

php authentication jwt laravel pusher

5
推荐指数
1
解决办法
2660
查看次数

标签 统计

authentication ×1

jwt ×1

laravel ×1

php ×1

pusher ×1