I try to authenticate user:
getDoctr
Try code from this answer. In your case firewall name is secured_area
:
// your controller action
public function myAction()
{
// Authenticating user
$token = new UsernamePasswordToken($user, null, 'secured_area', $user->getRoles());
$this->get('security.token_storage')->setToken($token);
//For Symfony <= 2.3
//$this->get('security.context')->setToken($token);
$this->get('session')->set('_security_secured_area', serialize($token));
}
Verify that you have configured encoders
section in security.yml, as configuration there has changed not very long time ago and it affects your problem.