Fork me on GitHub
#ring
<
2020-06-10
>
naomarik21:06:25

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/&amp;e=ATOZD4ap2qEIu9s8WqSMxXEb-Uz4MB293WKSrvgHBDFAH6ZQc4rIudY-1yzmHhrQDXcT1lGjtNEM9pweBTNKvmNajNfyN3I8jW1lmA&amp;s=1 but this bug happening on production too. Tested other websites and I seem to stay logged in fine.

naomarik21:06:03

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

naomarik21:06:44

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