title: Symfony force login and remember me
body: <p>Following code will force login user automatically and it works fine. I want to add remember me functionality. So when we force login user and then also add <strong><em>remember me</em></strong>, so next time he automatically login to the site.</p>
  
  <pre><code>// Auto Authenticate User
          $firewall = 'user_firewall';
          $token = new UsernamePasswordToken($user, null, $firewall, $user-&gt;getRoles());
          $this-&gt;get('security.token_storage')-&gt;setToken($token);
  
          $session = $this-&gt;get('session');
          $session-&gt;set('_security_'.$firewall, serialize($token));
          $session-&gt;save();
  </code></pre>