0

I'm trying to make a multi-auth in Laravel 5.8, but I'm facing a problem. When I set a guard on my auth::attempt, login is done successfully, but auth::check and auth::user return false and null respectively.

It only works when I change default guard in my config/auth.php to my custom-guard.

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

To:

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

I'd like to use a lot of guards, not just one. And whenever I need to, return their data with Auth::user. How can I do that?

1 Answer 1

1

I think you also need to specify a guard when calling Auth::check/user - for example:

Auth::guard('yourGuard')->check()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.