symfony - Symfony2 remember me on login manually -


hi cant work - have login done in other central website user redirected website - fine use normal db_provider , user entity make him login - works fine cant remember_me cookie work.

manual login done like

 $token = new usernamepasswordtoken($user, $user->getpassword(), "main", $user->getroles());  $this->get("security.token_storage")->settoken($token); 

then try this

 $remembermeservice = new tokenbasedremembermeservices(         array($this->getdoctrine()->getmanager()->getrepository('appbundle:user')), $this->container->getparameter('secret'), 'main', array(             'path' => '/',             'name' => 'myremembermecookie',             'domain' => 'localhost',             'lifetime' => 604800, // forever             'always_remember_me' => true,             'remember_me_parameter' => '_remember_me2')     ); 

and after

$response = new response();     $remembermeservice->loginsuccess($request,$response,$token);      $response->sendheaders(); 

in debug can see going class cookie , setting new cookie , cookie in object $response in headers never send browser.

and here have in security.yml

remember_me:           secret: '%secret%'           lifetime: 604800 # 1 week in seconds           path: ~           domain: ~           name: myremembermecookie           always_remember_me : true           remember_me_parameter: _remember_me2 

any ideas pls :)


Comments