dav
dav

Reputation: 21

Symfony 3 - How to keep session id after logging in?

I want to use the session ID to identify the records in the database for anonymous user. When the user logs in, I would like to bind/relate the data to the user id. However, after logging in the session id is automatically changed by what I lose data binding with the user.

How can I keep the session id after logging in order to bind the user id to the data, and then change the session id?

Upvotes: 2

Views: 2384

Answers (1)

Jovan Perovic
Jovan Perovic

Reputation: 20193

Upon authentication, session should be migrated, unless configured otherwise. Indeed, the session ID is not retained but the data should be there.

Have you checked the security.xml:

session_fixation_strategy:  migrate

This above should be the default (reference). What is the case with your config?

Hope this helps a bit...

Upvotes: 2

Related Questions