Losing session data between api calls when they come from Safari

I’m having a very tricky bug where session info is getting lost on Safari. Roughly, here is the flow of data through my app:

  1. A user begins filling out a form, submitting the payload to my phoenix server via api. Upon creation of the resource I add the :resource_id of the resource to the session.
  2. If on a later api call the user authenticates herself (which also adds a :user_id to the session), we fetch the :resource_id from the session, and then associate the resource with the user.

This is working fine on chrome & firefox, but on safari at some point between steps 1 and 2 the session info is getting lost.

The :resource_id is there immediately after (1), and the :user_id is there immediately after (2), but the :resource_id is getting lost between them.

Again, this is only happening in safari.

maybe this one: Set-cookie header works on Google Chrome and FF but no Safari

– or show more (pseudo) code…