Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Devise, OmniAuth & Facebook: "Not found. Authentication passthru."

Trying to follow along with https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview and I'm stumped.

I've got config.omniauth :facebook, ENV['FB_APP_ID'], ENV['FB_APP_SECRET'] in my config/initializers/devise.rb, devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" } in my routes.rb, and an OmniAuthCallbacks controller defined.

When I visit user_omniauth_authorize_path(:facebook), I get: Not found. Authentication passthru. I'm not sure what to do next. I am not using route globing, so I don't believe I need to define a passthru method, but doing so just gives me a 404.

like image 632
orbiteleven Avatar asked Dec 11 '12 02:12

orbiteleven


People also ask

What is OmniAuth?

OmniAuth is a library that standardizes multi-provider authentication for web applications. It was created to be powerful, flexible, and do as little as possible. Any developer can create strategies for OmniAuth that can authenticate users via disparate systems.

How does devise authentication work?

Devise is an excellent authentication system made for Rails that allows us to easily drop-in User functionality into our project. Devise only includes an email and password for registration, let's also add our own username to our User model. We also want to have a unique index on our username.

What is devise gem?

Devise is the cornerstone gem for Ruby on Rails authentication. With Devise, creating a User that can log in and out of your application is so simple because Devise takes care of all the controllers necessary for user creation ( users_controller ) and for user sessions ( users_sessions_controller ).


2 Answers

Also make sure you have added a route to the OmniauthCallbacksController:

devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }

and that you have added the update to the devise declaration in your User model:

devise :omniauthable, :omniauth_providers => [:facebook]
like image 169
11 revs, 10 users 40% Avatar answered Oct 04 '22 13:10

11 revs, 10 users 40%


I had the same error.
What worked for me was restarting the rails server, to reflect the changes (config.omniauth :facebook, ENV['FB_APP_ID'], ENV['FB_APP_SECRET']) I had made to config/initializers/devise.rb.

like image 25
elsapet Avatar answered Oct 04 '22 15:10

elsapet