ring

naomarik 2020-06-10T21:38:25.086800Z

I have a weird issue where redirects from Instagram are blowing away my session cookies. What's really weird is that logging in from the same tab as the fresh redirect, then refreshing will also blow it away. Only when I open a new tab my session will start sticking again. Googling anything similar doesn't show anything, any ideas? Here's the relevant ring code:

(defn wrap-base [handler]
  (-> ((:middleware defaults) handler)
      (wrap-defaults
       (-> site-defaults
           (assoc-in [:session :store] (cookie-store {:key "(censored-out)"}))
           (assoc-in [:session :cookie-attrs :max-age] (encore/secs :years 5))
           (assoc-in [:session :cookie-name] "sayartii")))
      wrap-flash
      wrap-context
      wrap-internal-error))
Can test this pretty fast with this URL with localhost: https://l.instagram.com/?u=http://localhost/&e=ATOZD4ap2qEIu9s8WqSMxXEb-Uz4MB293WKSrvgHBDFAH6ZQc4rIudY-1yzmHhrQDXcT1lGjtNEM9pweBTNKvmNajNfyN3I8jW1lmA&s=1 but this bug happening on production too. Tested other websites and I seem to stay logged in fine.

naomarik 2020-06-10T21:40:03.087Z

Refreshing the tab will constantly change the session cookie on the instagram redirected tab, but a normal tab it will stay as is.

naomarik 2020-06-10T21:40:44.087200Z

Seems consistent across browsers too, was first found out on iOS Safari