R
R
RS-qrsk2021-07-16 22:13:43
symfony
RS-qrsk, 2021-07-16 22:13:43

Remember Me not working correctly?

What could be the problem? The Remember me function is enabled, when the user logs in, two REMEMBERME and PHPSESSID cookies are created, everything is fine, but when the PHPSESSID cookie is deleted or after it expires, a new one is created and the user is immediately thrown to the authorization page, and he cannot go anywhere else, although he writes, that the user is authorized.
60f1d9bbdcb9f006607520.png

security.xml

main:
      remember_me:
                secret: '%kernel.secret%'
                lifetime: 604800
                path: /
                #always_remember_me: true
....
....

 access_control:
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: ROLE_ADMIN }
        - { path: ^/system/*, role: ROLE_ADMIN }
        - { path: ^/*, role: IS_AUTHENTICATED_FULLY  }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BoShurik, 2021-07-17
@RS-qrsk

IS_AUTHENTICATED_FULLYshould be replaced with IS_AUTHENTICATED_REMEMBERED
Here is the documentation

access_control:
    - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/register, role: ROLE_ADMIN }
    - { path: ^/system/*, role: ROLE_ADMIN }
    - { path: ^/*, role: IS_AUTHENTICATED_REMEMBERED  }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question