I have followed the manual because
I would like to use the remember_me token with Laravel. To verify it works I have a test middleware that do:
Auth::loginUsingId(1, true);
return $next($request);
Later, on my test view I have:
{{@if (Auth::check())}}
Yeah!
{{@endif}}
So yes I am authenticated, but no I do not have any remember_me cookie set. I only see the session cookie.
I have also tried to use Auth::User()->setRememberToken('foobar'), but I got the same result: no remember_me cookie.
As advised from this question, I have set my session settings to:
'lifetime' => 10080,
'expire_on_close' => true,
From this other question I verified that AuthenticateSession middleware is enabled:
protected $middlewareGroups = [
'web' => [
\App\Http\Middlewares\Test::class, // Auth user 1 by id
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\Session\Middleware\AuthenticateSession::class,
],
Of course if I do the following I get false:
dd(Auth::viaRemember());
Some other similar questions advise to use the cookies for the session. My config('session') looks like:
array:15 [▼
"driver" => "cookie"
"lifetime" => 10080
"expire_on_close" => true
"encrypt" => false
"connection" => null
"table" => "sessions"
"store" => null
"cookie" => "laravel_session"
"path" => "/"
"domain" => null
"secure" => false
"http_only" => true
"same_site" => null
]