Registration error in Laravel

2019-05-27 02:45发布

问题:

I use the default auth/registration in Laravel 5.3.

When I try to register new user I get error:

FatalThrowableError in RegistersUsers.php line 33:
    Call to undefined method Illuminate\Auth\TokenGuard::login()

I have made some changes in configuration Laravel:

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

So, by default I use api guard

回答1:

The authentication driver api you are trying to use is TokenBased. That means the server will issue your client a Token on successful authentication using credentials. Then, client can present this token to server while making the request to identify itself.

As given in laravel git, there isn't any method as login().

To use the TokenBased Authentication, here's the good guide