Wednesday, March 8, 2017

Laravel 5.4 Tymon JWT Auth Guard Driver Not Defined

I've implemented Tymon JWT for Laravel 5.4 & its working fine with users (default) model.

However, I want it to work for api guard not default web.

If I set default guard to api & set api driver to token as:

'api' => [
        'driver' => 'token',
        'provider' => 'app_users',
    ],

I get following error

Call to undefined method Illuminate\Auth\TokenGuard::attempt()

If I set api driver to jwt-auth, I get follwing error

Auth guard driver [api] is not defined.

Interestingly it works fine If I change driver to session.

'api' => [
        'driver' => 'session',
        'provider' => 'api_users',
    ],

Just wanted to know what driver should I set for JWT api tokens, as session driver is for web only?



via Imran Ali

Advertisement