Issue adding omniauth as middleware - ruby-on-rails

All - I'm using Rails 2.3.5 and Devise. I'm trying to integrate Onmiauth into my system. I'm having issues adding it as middleware. The gem is installed as verfied by 'gem list'.
When I try to add 'use OmniAuth::Strategies::Twitter, 'CONSUMER_KEY', 'CONSUMER_SECRET'' to my environment.rb I get the following error:
in `activate': can't activate rack (~>
1.1, runtime) for ["oa-core-0.2.0", "omniauth-0.2.0"], already activated
rack-1.0.1 for ["actionpack-2.3.5",
"rails-2.3.5"] (Gem::LoadError)
I ran rake:middleware and it is not listed as a middleware.
Any ideas?

This seems really similar to a question I just answered. Rather than writing the answer twice I'll just paste the link to my answer for others to be able to see my best guess as to what's going on. Hopefully this will help with anyone coming across this via Google:
Incompatability between Rails 2.3.5 and Omniauth

Related

undefined method `boolean_label_class=' for SimpleForm

Attempting to run migration for my Rails app pixel_paisan is getting an error reading; NoMethodError: undefined method `boolean_label_class=' for SimpleForm:Module. Gist for the trace at https://gist.github.com/nbarnes/9796454dc28be9792284. Source code for error-production app at https://github.com/nbarnes/pixel_paisan.
I've tried uninstalling and reinstalling simple_form, doesn't help. Update entire gemset, doesn't help. Different ruby versions via RVM, doesn't help. Plain vanilla Rails app, created in an attempt to reproduce the bug works fine. Google doesn't know about my issue.
Does anybody know anything about this? I'm rapidly running out of angles to attack it from.
Short answer: update your simple_form gem to 3.1.0+. You have simple_form (3.0.2)
Longer answer: See https://github.com/rafaelfranca/simple_form-bootstrap/issues/44 which seems to be someone who had the same issue where the answer is to upgrade to simple_form 3.1.0+ whereas your Gemfile has simple_form (3.0.2)

Migrating from restful_authentication to Devise with Rails 2.3.14

I am in the process of using the rails upgrade plugin (https://github.com/rails/rails_upgrade) to bring the application from 2.3.14 to 3.2. The plugin identified "restful_authentication" as something that needed to be replaced. After some research I decided to try to migrate to Devise.
I started looking at https://github.com/plataformatec/devise/wiki/How-To:-Migrate-from-restful_authentication-to-Devise, the issue I ran into is that these instructions are not meant for Rails 2.3.14.
I can figure out how to make most of it work for 2.3.14, but the biggest block I have ran into is that I am not sure which versions of Devise, Devise-encryptable and other gems to use. Is there an simple way to check?
Alliteratively am I making a mistake in trying to migrate to devise before I upgrade, should it be done the other way around?
Re: Is there a simple way to check? The short answer is no.
To know what Devise gems to use, just follow the directions in the devise wiki - you just need devise and devise-encryptable according to the wiki.
Re: Which one to do first: Whatever you decide to do, its a good idea to have a stable branch before attempting an upgrade. So either you a) upgrade Rails + get restful_auth working, or b) use Devise + upgrade Rails - just avoid trying to do both at the same time.
a) seems possible if you use https://github.com/Satish/restful-authentication . It's a fork of the original project, and neither are as active as Devise ( https://www.ruby-toolbox.com/categories/rails_authentication ). You may choose to upgrade your authentication system to devise anyway, which leads us to...
b) probably the road-more-travelled. You should be able to find plenty of (Rails 2.3) upgrade instructions for restful_authentication->Devise. Get your specs green, then attempt the Rails 3 upgrade.

Need both aws-sdk and aws-s3 gem, but they conflict with one another

In my previous post undefined method `find' for AWS::S3::Bucket:Class we figured out that the Amazon S3 uploader I was creating required aws-s3 gem, but I also had aws-sdk gem installed and those two conflict with each other.
The problem is that I am also using Paperclip and after removing aws-sdk, I found that my app broke.
Is there a workaround? I've search on Stackoverflow but haven't found a good solution yet. Also found this blog, but it seems dated: http://davesouth.org/stories/paperclip-upgrade-breaks-amazon-s3-upload-and-how-to-fix-it
I have used the fog gem with paperclip successfully to store images on amazon. In fact I found it easier to get working than the AWS gem. You could try swapping out that for aws-sdk.
What version of paperclip and rails are you using?
I came across the same problem but when I upgraded my rails to 3.1.10 and paperclip to 3.4.0, it works just fine. There is no need for any work around.
Not sure that it is good idea, but you could try to downgrade your Paperclip to that version, which is using aws-s3... As far as I can tell 2.4.5 is latest.

Building a new strategy for Omniauth, but Omniauth can't find it

I'm new to Rails and to Omniauth, so sorry in advance for the dumb
question.
I'm trying to do an Omniauth strategy for the Deezer website.
http://www.deezer.com/en/developers/simpleapi/oauth
First, I set up a basic rails application to test the Facebook strategy.
Here is my code in Github :
https://github.com/geoffroymontel/omniauth-test
And it works fine. Good.
Then I added those files in my app lib directory
lib/omniauth-deezer.rb
lib/omniauth/deezer.rb
lib/omniauth/deezer/version.rb
lib/omniauth/deezer/strategies/deezer.rb
and added
provider :deezer, ENV['DEEZER_APP_ID'],
ENV['DEEZER_APP_SECRET'], :perms => 'basic_access,email'
in
config/initializers/omniauth.rb
But when I start the app with
rails s
I get the following error message
/home/geoffroy/.rvm/gems/ruby-1.9.2-p290#rails3tutorial2ndEd/gems/omniauth-1.0.2/lib/omniauth/builder.rb:33:in `rescue in provider': Could not find matching strategy for :deezer. You may need to install an additional gem (such as omniauth-deezer). (LoadError) from /home/geoffroy/.rvm/gems/ruby-1.9.2-p290#rails3tutorial2ndEd/gems/omniauth-1.0.2/lib/omniauth/builder.rb:30:in `provider'
Thanks for your help
Best
Geoffroy
I added
require 'omniauth-deezer'
in initializers/omniauth.rb and it worked.
I don't really understand why I need it and Facebook doesn't.
In the Upgrading to 1.0 doc it is mentioned that Omniauth needs a gem for every provider now, so you'll have to move your provider to a gem eventually.
For future reference, if you want to add your own omniauth strategy, add this to your gemfile
gem 'omniauth-mystrategy', :path => '~/full-path-to-the-omniauth-folder/'
You´ll be using the local repository feauture of the gemfiles.
In the official bundler page you´ll see how to use remote repos also.
http://gembundler.com/v1.3/gemfile.html

Rails, OpenID and Authlogic

I've been following ryan baytes screencast #170 and adding ruby-openid, authlogic and authlogic-oid to an existing authlogic authentication system.
However, I keep getting the following stack of errors:
NameError (uninitialized constant OpenIdAuthentication::InvalidOpenId):
/Library/Ruby/Gems/1.8/gems/authlogic-oid-1.0.4/lib/authlogic_openid/session.rb:53:in openid_identifier='
/Library/Ruby/Gems/1.8/gems/authlogic-oid-1.0.4/lib/authlogic_openid/session.rb:47:incredentials='
authlogic (2.1.2) lib/authlogic/session/foundation.rb:28:in initialize'
authlogic (2.1.2) lib/authlogic/session/password.rb:140:ininitialize'
authlogic (2.1.2) lib/authlogic/session/activation.rb:48:in initialize'
authlogic (2.1.2) lib/authlogic/session/klass.rb:61:ininitialize'
authlogic (2.1.2) lib/authlogic/session/scopes.rb:79:in initialize'
app/controllers/user_sessions_controller.rb:10:innew'
app/controllers/user_sessions_controller.rb:10:in `create'
Is there anyone who's facing the same kind of problem? I'm using rails 2.3.4
I've tried binary's example app which is working perfectly well (rails 2.1.2), I've tried the code provided by Ryan Bates and it is working well too (rails 2.3.2). So, the libraries are working with previous versions of rails.
Any clues?
rails/open_id_authentication plugin has been updated a few days ago and it breaks compatibility with the authlogic_openid gem (v=1.0.4).
Youl'll have to wait until someone fix the authlogic_openid gem (the issue)
I have found this:
http://futureadapter.com/2009/11/13/authlogic-plugin-errorfix/
But I don't know how to apply this code ( were to I put it ? ) so that it fixes the authlogic_oid problem.
Can anyone check it out and see how to apply it?
Thanks.
Check this out:
http://testingauth.heroku.com/
Authlogic setup with openid and jquery selector.
Source:
http://github.com/shripadk/authlogic_openid_selector_example
Briefly... no
i guess there are too many dependent libraries and debugging the problem took a bit of time, so we shifted to using masquerade, making the app itself an openid provider.

Resources