In my custom oauth2 login I’m saving some session values. It was working fine till I recently pulled the latest code from branch tests-passed
and noticed that session
is always nil in omniauth_callback_controller.rb
def complete
auth = request.env[“omniauth.auth”]
auth[:session] = session # it doesn’t contain my session value
Then i found out session_store was changed in latest pull
Discourse::Application.config.session_store(
:discourse_cookie_store, #it use to be :cookie_store
key: ‘_forum_session’,
path: (Rails.application.config.relative_url_root.nil?) ? ‘/’ : Rails.application.config.relative_url_root
)
even it raises csrf_detected
failure at callback_phase
method at oauth2 strategy file if opts[:provider_ignores_state]
is set to true, cuz session[‘omniauth.state’] is nil
elsif !options.provider_ignores_state && (request.params[“state”].to_s.empty? || request.params[“state”] != session.delete(“omniauth.state”))
fail!(:csrf_detected, CallbackError.new(:csrf_detected, “CSRF detected”))
Just to mention, everything works fine if I change it to :cookie_store
rather than ':discourse_cookie_store`. is it a bug?