Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JWT "User not found" exception in case of multiple user providers #171

Closed
fouding opened this issue Jul 25, 2019 · 1 comment
Closed

JWT "User not found" exception in case of multiple user providers #171

fouding opened this issue Jul 25, 2019 · 1 comment
Labels
wontfix This will not be worked on

Comments

@fouding
Copy link

fouding commented Jul 25, 2019

  1. Tell us your software version

+--------------------------+---------+
| Component | Version |
+--------------------------+---------+
| PHP | 7.1.23 |
| Swoole | 4.2.2 |
| LaravelS | 3.5.8 |
| Laravel Framework [test] | 5.5.40 |
+--------------------------+---------+

  1. Detail description about this issue(error/log)

I have multiple user providers in config/auth.php:

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

        'users2' => [
            'driver' => 'eloquent',
            'model' => App\User2::class,
        ],

        'users3' => [
            'driver' => 'eloquent',
            'model' => App\User3::class,
        ],
    ],


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

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

        'api2' => [
            'driver' => 'jwt',
            'provider' => 'users2',
        ],

        'api3' => [
            'driver' => 'jwt',
            'provider' => 'users3',
        ],
    ]

The requests using user2/user3 provider throw User not found exception from Tymon\JWTAuth\Http\Middleware\BaseMiddleware:71.

I have go thru #109, but my issue seems to be a different one.

I guess the solution is to reset the user provider for each auth, but I have no idea how to implement it.

Thanks.

@hhxsv5 hhxsv5 added the analyzing Analyzing this issue label Jul 25, 2019
@fouding
Copy link
Author

fouding commented Aug 6, 2019

Resolved.

It's my fault to use same UserProvider for different modules. Use different UserProvider for each module and the issue disappears.

@fouding fouding closed this as completed Aug 6, 2019
@hhxsv5 hhxsv5 added wontfix This will not be worked on and removed analyzing Analyzing this issue labels Aug 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants