Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony 2 "Your session has timed out or you have disabled cookies"

One of three things caused this and I am not sure which of the 3 it was. So I will mention all 3 in the hope it will help others save time.

Initially I changed database user credentials within parameters.yml This wasn't working as the user in question couldn't log in from localhost. That said, I used the site to test the connection, which might have upset the cookie.

I had some cache folder permissions issues due to a missing image. So I had to clear the cache and adjust some permissions as you do every time.

Finally, I changed the paths for security.yml

        form_login:
            login_path:  /login
            check_path:  /login_check
        logout:
            path:   /logout

to:

        form_login:
            login_path:  /account/login
            check_path:  /account/login_check
        logout:
            path:   /account/logout

Along with the appropriate changes in routing.yml

The result was that my already logged in user not longer passed security credentials and if I tried to login in via a different user/browser, I was always faced with: "Your session has timed out or you have disabled cookies"

Many many hours were spent following red herrings, checking security, login handling, redis etc.

Answer below.

like image 629
Adi Avatar asked Nov 01 '14 23:11

Adi


1 Answers

I ultimately found the answer here: Symfony authentication - can't get past login page in production (The answer by pleerock)

But wanted to link the error message in my subject line with this solution below:

security:
    firewalls:
        main:
            form_login:
                require_previous_session: false

This fixed the issue for browsers which hadn't been logged in prior to the problem.

For my browser which had already been logged in, I had to manually delete the session cookie to get things working again.

like image 80
Adi Avatar answered Oct 20 '22 18:10

Adi