phpMick
244
16
General

Authentication problem in 5.3

Posted 2 years ago by phpMick

Not sure what I am doing wrong here.

Working through this:

https://laravel.com/docs/5.3/authentication

did this:

php artisan make:auth

In my controller I have:

$this->middleware('auth');

$this->user = Auth::user();

//also tried
  $this->user = auth()->authenticate();


When I step through the code, I can see it hit the line where it assigns to $this->user, then it throws and unauthenticated error.

This gets caught in Handler.php and I get redirected:

    return redirect()->guest('login');

But, I don't go back to login, I seem to go to home somehow.

Why does it keep redirecting to home?

Mick

Please sign in or create an account to participate in this conversation.