tymondesigns / jwt-auth

🔐 JSON Web Token Authentication for Laravel & Lumen
https://jwt-auth.com
MIT License
11.28k stars 1.54k forks source link

Can login and gets token but Auth::check() is false #1524

Open shafikhaan opened 6 years ago

shafikhaan commented 6 years ago

Subject of the issue

I can get authenticated a user on login and also i am getting the object of authenticated user and sending it off in the response.

But when i do Auth::check(), It gives me false.

Following is my config/auth.php

'defaults' => [
     'guard' => 'web',
     'passwords' => 'users',
],

'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],

        'api' => [
            'driver' => 'jwt',
            'provider' => 'users',
        ],

        'admins' => [
            'driver' => 'session',
            'provider' => 'admins',
        ],
    ],

'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => App\User::class,
        ],

        'admins' => [
            'driver' => 'eloquent',
            'model' => App\Admin::class,
        ],
    ],

'passwords' => [
        'users' => [
            'provider' => 'users',
            'table' => 'password_resets',
            'expire' => 60,
        ],
    ],

Your environment

I am using laravel 5.5.

Expected behaviour

Auth::check() should be true after login is what i am expecting.

elrosi commented 6 years ago

Hi, i also do not work Auth::attempt($credentials) and JWTAuth::attempt($credentials) Login will not complete.

lmj0011 commented 6 years ago

sounds similar to this issue: https://github.com/tymondesigns/jwt-auth/issues/1290

see https://github.com/tymondesigns/jwt-auth/issues/1290#issuecomment-377153100