LuigiAlver
LuigiAlver

Reputation: 201

auth/google_oauth2 not working on rails app

I was able to make an authentication using Facebook and wanted to try Google for my rails app but after installing the gem omniauth-google-oauth2 and giving the proper code to the omniauth.rb I can´t make it work to the url /auth/google_oauth2

Here is my code:

    OmniAuth.config.logger = Rails.logger

    Rails.application.config.middleware.use OmniAuth::Builder do
     provider :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_SECRET'],
     :scope => 'email', :display => 'popup'
     provider :google_oauth2, ENV["GOOGLE_CLIENT_ID"], ENV["GOOGLE_CLIENT_SECRET"], 
     {
         :name => "google",
         :scope => "email, profile, plus.me, http://gdata.youtube.com",
         :prompt => "select_account",
         :image_aspect_ratio => "square",
         :image_size => 50
     }


end

After i run the bundle installcommand and try to go to /auth/google_oauth2 I get the error No route matches [GET] "/auth/google_oauth2". I followed the instructions of the gem and also I did not need to set a route for the /auth/facebook method.

Is there anything I'm doing wrong?

Upvotes: 1

Views: 2153

Answers (1)

Gideon Rosenthal
Gideon Rosenthal

Reputation: 2033

Try directing to:

/auth/google

Upvotes: 1

Related Questions