It's been some times now that I'm struggling to make the autologin work on my Silex project.
I've been using the Silex doc to implement the RememberMeServiceProvider (http://silex.sensiolabs.org/doc/providers/remember_me.html) so that my app.php looks like that :
$app->register(new Silex\Provider\SecurityServiceProvider(), array(
'security.firewalls' => array(
'secured' => array(
'pattern' => '^/',
'anonymous' => true,
'logout' => true,
'form' => array('login_path' => '/login', 'check_path' => '/login_check', 'always_use_default_target_path' => true, 'default_target_path' => '/login/redirect'),
'remember_me' => array(
'key' => MD5('secret_key'),
'always_remember_me' => true,
),
'users' => $app->share(function () use ($app) {
return new MyProject\DAO\UserDAO($app['db']);
}),
),
),
'security.role_hierarchy' => array(
'ROLE_ADMIN' => array('ROLE_USER'),
),
'security.access_rules' => array(
array('^/admin', 'ROLE_ADMIN'),
),
));
$app->register(new Silex\Provider\RememberMeServiceProvider());
For now, when I log in, a REMEMBERME cookie is set (by default for a year).
But when I close my browser and come back on my project, no auto-login is done... The cookie is still there.
Anyone could help me making the autologin work?
Thank you very much in advance.