Help with development with built-in Omniauth support

I tried to follow https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview , but for some reason, when I look at the generated routes, I see only the callback path, not the path authorization (and, indeed, I get an error in the view using the user_omniauth_authorize_path link).

I assume that this may be the problem of the versions of OmniAuth and Devise ( since after 0.2.0.beta Omniath allows you to configure parameters and routes must be defined ). However, when I try to use an older version of OmniAuth version, I get the error message " You are using an old OmniAuth version, please ensure 0.2.0.beta or later installed. ".

I tried to work with Devise master, 1.2.rc and omniauth branch, and with whole omniauth stone (after 0.2.0.beta) and with "oa-oauth", but without success. I also tried to determine the route:

 match '/users/auth/:action/', :to => 'users/omniauth_callbacks#action', :as => 'user_omniauth_authorize' 

This helped in this route, but when I clicked the link, I got an error that could not be found during creation. Funny enough to change the controller in devise_for to be invalid (for example, adding '/' in front of users / omniauth _callbacks) led to an error for the first time ("The controller name should not start with a slash"), but a small reboot was actually sent me to facebook and back (but naturally the callback route was not defined).

I am new to Ruby, and not quite sure where I am going from here. Any help would be appreciated.

+8
authentication ruby-on-rails oauth devise omniauth
source share
2 answers

My problem was with various omniauth versions and development. What ended up working using this configuration in my gemfile:

 gem 'devise', :git => 'git://github.com/plataformatec/devise.git' gem 'omniauth', '>=0.2.0.beta' gem 'oa-oauth', :require => 'omniauth/oauth' 

you can see more details about my implementation here .

0
source share

This method is determined by development , not through routes. Therefore, it will not be displayed when running rake routes . This method accepts one of the oauth providers that you configured in config / initializers / devies.rb. For example, if you defined the following in devise.rb:

 config.omniauth :facebook, FACEBOOK_APP_ID, FACEBOOK_APP_SECRET 

Then you should create an authorization link as follows:

 <%= link_to "Facebook Sign in", user_omniauth_authorize_path(:facebook) %> 
+6
source share

All Articles