Paul
Paul

Reputation: 69

Incompatability between Rails 2.3.5 and Omniauth

I use Rails 2.3.5 and want to use Omniauth however I can't get them to work together, as rails 2.3.5 requies Rack 1.0.1 and Omniauth (version 0.1.6) requires Rack 1.1

I deploy on Heroku so I don't believe I can hack into Rails and remove the hard dependency on version 1.0.1 of Rack.

Any help very much appreciated.

Paul

Upvotes: 1

Views: 433

Answers (1)

stevenhaddox
stevenhaddox

Reputation: 1215

We had a similar issue. We were on Rails 2.3.4 and wanted to use OmniAuth (0.2.6). Unfortunately the only possible solution I've found so far is to upgrade to Rails 2.3.8 or later which runs on Rack 1.1 (the minimum required by OmniAuth) and then require OmniAuth like so:

# In config/environment.rb require 'omniauth' (or 'oa-<strategy_name>') before Rails::Initialize
require 'omniauth'
Rails::Initializer.run do |config|
  ...

# Add your own initializer for OmniAuth
# /config/initializers/omniauth.rb
ActionController::Dispatcher.middleware.use OmniAuth::Builder do
  # your strategy provider logic
end

This was mostly groomed from this thread / links in it: http://groups.google.com/group/omniauth/browse_thread/thread/676fa835428e9c83

Unfortunately I'm in the middle of all of this right now so I can't promise this works fully as I'm using a custom strategy and haven't quite made it all the way to the end yet. Hopefully it provides some starting points for you to dig deeper if you're still stuck on this if nothing else.

Upvotes: 2

Related Questions