1
votes

I am trying to implement login from google in my rails app.I am following instructions from README file at github page of the "omniauth-google-oauth2" LINK.I am trying to use the name parameter in devise.rb config file so that links are from "google" and not "google_oauth2".
So i have added:

config.omniauth :google_oauth2, "GOOGLE_CLIENT_ID", "GOOGLE_CLIENT_SECRET", { name: "google" }

But in the bottom links of devise views the link is still
http://localhost:3000/users/auth/google_oauth2
but clicking on this link gives
Not found. Authentication passthru.
on page.
But now
http://localhost:3000/users/auth/google
works.How do i fix the link?
1

1 Answers

2
votes
config.omniauth :google_oauth2, "GOOGLE_CLIENT_ID", "GOOGLE_CLIENT_SECRET", { name: "google" }

Works just fine to change the provider name. 2 caveats

  1. Change it everywhere! Make sure your callback is using google, make sure your callback url (in the google developer console) uses google
  2. Restart your server - because it's in an initializer, any changes you've made won't be activated until you restart

Test App: https://github.com/trh/devise_omniauth_google