I am working through Ryan Bates railscast #235 OmniAuth Part 1, using the OmniAuth gem to allow users to sign in to my web app using Twitter or Facebook and later Google Apps.
Right now I am encountering this error
Routing Error
No route matches [GET] "/auth/twitter"
I have correctly set up my routes.rb file to handle the auth callback provider match like so:
match "/auth/:provider/callback" => "authentications#create"
When i link to localhost:3000/auth/twitter, i get this error. where as Bates in his Railscast at -07:36.
What could be a possible solution to this issue? Would it be an issue with routes.rb? or omniauth.rb?
Our omniauth.rb looks like this:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :facebook, 'OURCONSUMERKEY', 'OURCONSUMERSECRET'
provider :twitter, 'OURCONSUMERKEY', 'OURCONSUMERSECRET'
end
You need to comment out ':omniauthable' in your model used by the Devise gem (usually it's the model 'User' = the user.rb file):
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable, :recoverable,
:rememberable, :trackable, :validatable # plus whatever other calls...
# :omniauthable
[...]
end
Using the ':omniauthable' call means loading devise/omniauth components (which cause conflicts with your omniauth setup).