doujiong3146 2017-03-08 19:44
浏览 873

Laravel 5.4 Tymon JWT Auth Guard驱动程序未定义

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?

  • 写回答

2条回答 默认 最新

  • dounou9751 2017-03-14 23:09
    关注

    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

    评论

报告相同问题?