How to use token authentication in laravel web page

Viewed 10275

I am trying to use JWT for laravel web page instead of session. so I made some changes.

  1. Installed jwt-auth and configure

  2. Then changed default guard as api in config/auth.php

    'defaults' => [
        'guard' => 'api',
        'passwords' => 'users',
    ],
    
    'guards' => [
        ...
    
        'api' => [
            'driver' => 'token',
            'provider' => 'users',
        ],
    ],
    

Now I am getting error

(1/1) FatalErrorException Call to undefined method Illuminate\Auth\TokenGuard::attempt() in AuthenticatesUsers.php (line 75)

How to fix this and start token authentication for laravel web page(blades not API).

5 Answers
Related