Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No route matches [GET] "/auth/facebook"

i am getting this error when i am using omniauth, devise with rails 3.1.3.I have installed the omniauth gem & omniauth facebook.

Configured the routes.rb as match '/auth/:provider/callback',to: 'authentications#create' asper the guide https://github.com/intridea/omniauth

Whenever i browse the url http://localhost:3003/auth/facebook/, i am finding routing error

**No route matches [GET] "/auth/facebook"**

Please help on this.I have the related post in stackoverflow, and none seems to get worked

like image 932
Thillai Narayanan Avatar asked Dec 28 '11 19:12

Thillai Narayanan


3 Answers

I had the same problem when using Rails 3.2, OmniAuth 1.0.2 and Devise 2.0.

Apparently there is a problem with the 'path_prefix'. But when manually reconfigured everything works.

Try do this in your initializer:

Rails.application.config.middleware.use OmniAuth::Builder do
  configure do |config|
    config.path_prefix = '/auth'
  end
  ...
end
like image 117
Anderson Bravalheri Avatar answered Nov 15 '22 09:11

Anderson Bravalheri


I had the same problem and found out that it was caused by :omniauthable devise module. You will need to comment out the module, for example:

#app/model/user.rb
def User
    ...
    devise :database_authenticatable, :registerable, :confirmable,
           :recoverable, :rememberable, :trackable, :validatable#, :omniauthable
    ...
end

Sorry for the late response.

like image 44
codynguyen Avatar answered Nov 15 '22 07:11

codynguyen


After some hours trying to fix this issue I realized that i'd config/initializers/omniauth.rb in the .gitignore file (shame on me).

so remove omniauth.rb from the .gitignore list if you haven't already

like image 25
jstnno Avatar answered Nov 15 '22 09:11

jstnno