t-n-y
t-n-y

Reputation: 1209

remember me symfony2 cookie deleting when closing the browser

I want to add a "remember me" to my login form.

I've done everuthing like in the symfony2 documentation

here is my security.yml file:

remember_me:
            key:      "%secret%"
            lifetime: 31536000
            path:     /
            domain:   ~ 

And i have added this checkbox in my login form :

<input type="checkbox" id="remember_me" name="_remember_me" />

when i log in to my account, the cookie is created, but when i close my browser and come back, i don't have remember me cookie anymore

anyone see where is the problem ?

thanks for your answers

Upvotes: 1

Views: 703

Answers (1)

Peter Bailey
Peter Bailey

Reputation: 105916

Have you tried inspecting the response headers to make sure you're getting a validly-formed Set-Cookie header? Specifically the expires component?

Here's one for a Symfony2 site I've got (with the actual value greatly shortened for purposes of pasting here with legibility)

Set-Cookie:REMEMBERME=SldUXEV1Z; expires=Tue, 29-Oct-2013 20:13:22 GMT; path=/; httponly

I have the lifetime set at 86400 (24 hours) and insce I just logged in, this looks correct.

I used Chrome's dev tools to inspect the headers

Upvotes: 1

Related Questions