1

I was able to make Rack::Session::DataMapper, Padrino and Omniauth work together. The main goal was to have the same sessions and users in the main app and in the admin section, and to have very long lasting sessions. Option set :sessions was disabled, so I patched /padrino-core-0.9.23/lib\padrino-core/application.rb:203 use Rack::Flash if flash? to not require sessions?. Also I patched /padrino-admin-0.9.23/lib/padrino-admin/access_control.rb:15 to not enable sessions.

Here is my app code:

/admin/app.rb:

set :session_id, 'superapp.pro'.to_sym
use Rack::Session::DataMapper

/app/app.rb:

set :session_id, 'superapp.pro'.to_sym
use Rack::Session::DataMapper

/lib/omniauth_init.rb:

use Rack::Session::DataMapper

Question is: is there a nicer way to befriend custom rack session store with Omniauth? I'm not comfortable with using Rack::Session::DataMapper three times.

ujifgc
  • 2,215
  • 2
  • 19
  • 21

1 Answers1

0

Late answer, but I believe if you put:

Padrino.before_load do
    Padrino.use Rack::Session::DataMapper
end

in the your "config/boot.rb" you'll be fine, and won't need duplicates.

Foot
  • 449
  • 4
  • 13
  • @ujifgc Sorry, should have been "Padrino.use", not just "use". Edited my answer. Give it a try. – Foot Feb 29 '12 at 17:19