I installed the authentication plugin on a fresh CakePHP 4 project. Enabled regarding the documentation and it works for session-based auth. I want to add remember me functionality, so added
->add(new EncryptedCookieMiddleware(['CookieAuth'], Configure::read('Security.cookieKey'))) to the $middlewareQueue variable in Application@middleware. There is no any explanation how to generate the cookieKey actually, but I used a random string to test. Also added
$service->loadAuthenticator('Authentication.Cookie', [ 'fields' => $fields, 'loginUrl' => '/users/login', ]);
remember me field is
remember_me by default. So I added
<?= $this->Form->control('remember_me', ['type' => 'checkbox']); to the login form. I tried to check it and login, but it doesn’t add the cookie to the browser when I check with Chrome DevTools.
What am I missing?
Thanks in advance.