# Autentication " Remember me" cookie cakephp 4 not working correctly after login

**URL:** <https://discourse.cakephp.org/t/autentication-remember-me-cookie-cakephp-4-not-working-correctly-after-login/11197>\
**Category:** Uncategorized\
**Created:** [May 8, 2023, 5:33pm UTC](https://discourse.cakephp.org/t/autentication-remember-me-cookie-cakephp-4-not-working-correctly-after-login/11197 "2023-05-08T17:33:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![argenis4](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@argenis4](https://discourse.cakephp.org/u/argenis4)\
**Post date:** [May 8, 2023, 5:33pm UTC](https://discourse.cakephp.org/t/autentication-remember-me-cookie-cakephp-4-not-working-correctly-after-login/11197/1 "2023-05-08T17:33:20Z")

</div>

I am working with CakePHP 4.  
Following the documentation, I set the ‘remember me’ cookie, when I pass the login, I don’t see in the browser the created CookieAuth.  
in aplication.php

public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue  
{  
$middlewareQueue-\>add(new ErrorHandlerMiddleware(Configure::read(‘Error’)))  
-\>add(new AssetMiddleware())  
-\>add(new RoutingMiddleware($this))  
-\>add(new BodyParserMiddleware())  
-\>add(new EncryptedCookieMiddleware(  
[‘CookieAuth’],  
Configure::read(‘Security.cookieKey’)  
))  
-\>add(new AuthenticationMiddleware($this));  
return $middlewareQueue;  
}

getAuthenticationService

$service-\>loadAuthenticator(‘Authentication.Cookie’, [//‘rememberMeField’ =\> ‘remember\_me’,  
‘fields’ =\> $fields, ‘cookie’ =\> [‘name’ =\> ‘CookieAuth’, ‘expires’ =\> (new Time())-\>addDays(30),], ‘loginUrl’ =\> ‘/users/login’ ]);

in config/app  
‘Security’ =\> [  
‘salt’ =\> env(‘SECURITY\_SALT’, ‘algo’),  
‘cookieKey’ =\> env(‘SECURITY\_COOKIE\_KEY’, ‘algo’),  
],

login.php

\<? echo $this-\>Form-\>control('remember\_me', ['type' =\> 'checkbox']); ?\>
