Passing data from anonymous to authenticated session

1
Hi, is it possible to pass data from an anonymous to an authenticated session? Scenarios: User selects a booking slot as an anonymous user but has to login to compete the booking, with the selected booking slot being passed through or accessible once authenticated User creates a shopping basket as an anonymous user but has to login to compete the purchase, with the selected items being passed through or accessible once authenticated   From what I’ve looked at $CurrentSession changes from an anonymous to authenticated, so is there another way to pass through or uniquely reference previously selected data once authenticated?
asked
1 answers
0

Switching means also a new session. So you have basically no reference.

In my opinion:

  1. You need to keep a non-persistent or not commited to db object in memory. Keeping is possible by passing this to the login page. This means there’s still an existing reference to the object, so it will not be cleaned up by the garbage collector. After login you need to process the temp data. Maybe you need a custom login to achieve this.
  2. An alternative is to store it in local storage until the auth is done. After auth you need to process this local data.

 

To be honest, both solutions look not very clean to me.

answered