Hi after last night with 2 hours of hopeless debugging I’m going to ask here.
I need to persist data across two HTTP requests. Basically just a way to keep track of CSRF token sent via OAuth. Should be simple. I just put the data into a session and I’m good to go. put_session( :oauth_state, state)
should work perfectly fine. But it doesn’t I’m not able to get any data out of it on the second request. Nothing.
When I try cookies it works great. When second request arive I can only get cookie but not the session.
put_resp_cookie(conn, "oauth_state", state)|> put_session( :oauth_state, state)
I tried even to fetch the session and still nothing. conn = fetch_session(conn)|> get_session(conn)
The result was %{}
. I tried to extend :max_age
to 1 hour with no effect.
I use POW persistent storage but it uses a different cookie.
Phoenix 1.5.4
Plug version 1.10.3
POW 1.0.20.
EDIT: Flash messages don’t work outside live views as well.