Does not work on Rails 4
sanjiv-hartleylab opened this issue · comments
Could you please provide steps to reproduce? Tests that break would be even better. Thanks.
I'm not sure exactly what @sanjiv-hartleylab is seeing however I was having issues with Rails 4.2.7 loading a session created by this plug. I solved it by calling put_session(conn, "session_id", Base.encode16(:crypto.strong_rand_bytes(16), case: :lower))
to add a session id. It appears that without a session id Rails doesn't think a session exist when it tries to load it.
@paulnicholson where did you add the put_session
call in your app?
@fbjork Well, my motivation for getting this to work was rails <-> elixir form posting with csrf validation. I wrote a plug to handle csrf protection in a rails compatible way and that plug ensures the session has a session id. See gatherdigital/plug_rails_csrf_protection@ff12afd/lib/plug_rails_csrf_protection.ex#L202