Closed Evgl1 closed 1 year ago
@Evgl1
By default, the session expiration time is around 10 min means if you are inactive on site from the last 10 min it will automatically log out after 10 minutes of inactivity.
If you wish to change it follow the below solution:
Locate path in your project config -> packages -> framework.yaml
You will basically store the sessions in the /var/sessions/ directory and that's it, the lifetime option will work again. You can do this quickly by modifying your framework.yaml file in the session block like this:
session:
handler_id: session.handler.native_file
save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%'
# 2 Days lifetime (172800 seconds)
cookie_lifetime: 172800
cookie_secure: 'auto'
cookie_samesite: 'lax'
Most probably it should work for you.
And after saving the framework.yaml file you should clear your project cache by the below command:
php bin/console c:c
handler_id: null
cookie_lifetime: 172800
cookie_secure: auto
cookie_samesite: lax
storage_factory_id: session.storage.factory.native
It didn't work for me, please tell me, should I add something else?
@Evgl1
handler_id: null cookie_lifetime: 172800 cookie_secure: auto cookie_samesite: lax storage_factory_id: session.storage.factory.native
It didn't work for me, please tell me, should I add something else?
You have not added in handler_id: session.handler.native_file and also not added the save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%' option so please you will add complete the below lines.
You will add all these lines the same as just copy and paste it into the framework.yaml file:
session:
handler_id: session.handler.native_file
save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%'
# 2 Days lifetime (172800 seconds)
cookie_lifetime: 172800
cookie_secure: 'auto'
cookie_samesite: 'lax'
We are closing this issue, If you are still facing the same error then reply in the same thread.
Hello. Can you please tell me how to increase the cookie time? Forces me to re-authorize every half hour...