# Discourse Cookie Store: Omniauth callback sessions are nil

**URL:** <https://meta.discourse.org/t/discourse-cookie-store-omniauth-callback-sessions-are-nil/58096>\
**Category:** Bug\
**Created:** [28. Februar 2017 um 15:45 UTC](https://meta.discourse.org/t/discourse-cookie-store-omniauth-callback-sessions-are-nil/58096 "2017-02-28T15:45:14Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![leo.proctor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leo.proctor/32/216158_2.png) [@leo.proctor](https://meta.discourse.org/u/leo.proctor)\
**Post date:** [28. Februar 2017 um 15:45 UTC](https://meta.discourse.org/t/discourse-cookie-store-omniauth-callback-sessions-are-nil/58096/1 "2017-02-28T15:45:14Z")

</div>

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?

---

_[View the full topic](https://meta.discourse.org/t/discourse-cookie-store-omniauth-callback-sessions-are-nil/58096)._
