Method Laravel\Passport\Guards\TokenGuard::attempt does not exist
Master-Daniel opened this issue · comments
Passport Version
11.3
Laravel Version
9
PHP Version
8.1.6
Database Driver & Version
No response
Description
I am trying to create a multi-authentication using passport for my API endpoint have setup my authentication guards and providers with the appropriate model but each time I send a login request I get "Method Laravel\Passport\Guards\TokenGuard::attempt does not exist"
Steps To Reproduce
LOGIN: Auth::guard('super-admin')->attempt(['email' => $credentials['login'], 'password' => $credentials['password']]);
GUARDS: 'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'member' => [
'driver' => 'passport',
'provider' => 'members',
],
'admin' => [
'driver' => 'passport',
'provider' => 'admins',
],
'super-admin' => [
'driver' => 'passport',
'provider' => 'superAdmins',
],
'api' => [
'driver' => 'passport',
'provider' => 'users',
],
],
PROVIDERS: 'providers' => [
'members' => [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
'admins' => [
'driver' => 'eloquent',
'model' => App\Models\CooperativeAdmin::class,
],
'superAdmins' => [
'driver' => 'eloquent',
'model' => App\Models\Admin::class,
],
'users' => [
'driver' => 'database',
'table' => 'users',
],
],
Hi there,
Thanks for reporting but it looks like this is a question which can be asked on a support channel. Please only use this issue tracker for reporting bugs with the library itself. If you have a question on how to use functionality provided by this repo you can try one of the following channels:
However, this issue will not be locked and everyone is still free to discuss solutions to your problem!
Thanks.
Hey @Master-Daniel ,
did you get any solution for this? I am also trying to implement multi-guard authentication in my application. But, I receive the same error while trying to get Authorize code from 'http://localhost:8000/oauth/authorize'.
It redirect me to the login page, but if I enter credential from custom guard. It's not working.
Is there a better way to get 'authorization code' with 'custom guard table' credentials.
I have also posted same question on laravel.io
https://laravel.io/forum/how-to-use-custom-guard-with-laravel-passport
Thanks,
Amit