Building a new strategy for Omniauth, but Omniauth cannot find it

I'm new to Rails and Omniauth, so sorry in advance for the dumb question.

I am trying to make an Omniauth strategy for the Deezer site. http://www.deezer.com/en/developers/simpleapi/oauth

First, I installed the basic Facebook strategy checker application. Here is my code on Github: https://github.com/geoffroymontel/omniauth-test

And it works great. Good.

Then I added these files to my lib application 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'

at

config/initializers/omniauth.rb

But when I launch the application with

rails s

The following error message appears

/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 the help

The best

Geoffroy

+5
source share
3 answers

I added

require 'omniauth-deezer'

in the /omniauth.rb initializers, and that worked.

, , Facebook - .

+4

Upgrading to 1.0 doc , Omniauth , .

+2

In the future, if you want to add your own omniauth strategy, add it to your gemfile

gem 'omniauth-mystrategy', :path => '~/full-path-to-the-omniauth-folder/'

You will use the local gem file storage. On the supplier’s official page, you will also see how to use remote repositories.

http://gembundler.com/v1.3/gemfile.html

+2
source

All Articles