Reputation: 392
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?
Upvotes: 1
Views: 8373
Reputation: 392
Posting answer to my question:
There is no guard support for JWT 0.5. You will need to use one of the latest 1.0.0- versions.
Thanks.
Upvotes: 5
Reputation: 401
If you use Tymon JWT package, 1.0 beta version, you can implement jwt guard very easily.
Documentation for that feature is not ready yet, but you can follow this mini-tutorial https://github.com/tymondesigns/jwt-auth/issues/860
Upvotes: 1