Make sure that in your config/auth you have this:
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'passport',
'provider' => 'users',
],
],
Then your API routes should be protected like this:
Route::group(['prefix' => 'v1', 'middleware' => ['auth:api'], function () {
});
Now from here:
[https://laravel.com/docs/5.8/authentication](http://)
Path Customization
When a user is successfully authenticated, they will be redirected to the /home URI. You can customize the post-authentication redirect location by defining a redirectTo property on the LoginController, RegisterController, ResetPasswordController, and VerificationController:
protected $redirectTo = '/'; Next, you should modify the RedirectIfAuthenticated middleware's handle method to use your new URI when redirecting the user.
If the redirect path needs custom generation logic you may define a redirectTo method instead of a redirectTo property:
protected function redirectTo() { return '/path'; }
Hope this helps,
Ben
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community