dusterio / lumen-passport

Making Laravel Passport work with Lumen
MIT License
654 stars 141 forks source link

Unable to determine authentication model from configuration #52

Closed manoj-infrasssist closed 7 years ago

manoj-infrasssist commented 7 years ago

while requesting the access token for password grant type I got the error URL : http://localhost:8000/oauth/token Error : Unable to determine authentication model from configuration.

dusterio commented 7 years ago

You haven't specified user model (class) in your config files, Laravel Passport throws this error:

        if (is_null($model = config('auth.providers.'.$provider.'.model'))) {
            throw new RuntimeException('Unable to determine authentication model from configuration.');
        }

Just make sure your providers.{provider}.model is set in config/auth.php

manoj-infrasssist commented 7 years ago

Thanks for the reply. But I have included the model in config/auth.php. Below is the code in config/oauth.php

return [
'defaults' => [
    'guard' => 'api',
    'passwords' => 'users',
],

'guards' => [
    'api' => [
        'driver' => 'passport',
        'provider' => 'users',
    ],
],

'providers' => [
    'users' => [
        'driver' => 'eloquent',
        'model' => \App\User::class
    ]
]
];
manoj-infrasssist commented 7 years ago

Hi Dusterio, I found out the issue. I had not included the <?php tag in config/auth.php. After including <?php tag that error gone but another error displayed

Trait 'App\HasApiTokens' not found