[英]Rails devise+omniauth-google-oauth2
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".我正在尝试在我的 Rails 应用程序中实现从谷歌登录。我正在按照“omniauth-google-oauth2”链接的 github 页面上的 README 文件中的说明进行操作。我正在尝试在 devise.rb 配置文件中使用 name 参数,以便链接来自“google”而不是“google_oauth2”。
So i have added:所以我补充说:
config.omniauth :google_oauth2, "GOOGLE_CLIENT_ID", "GOOGLE_CLIENT_SECRET", { name: "google" }
http://localhost:3000/users/auth/google_oauth2but clicking on this link giveshttp://localhost:3000/users/auth/google_oauth2
Not found.on page.未找到。 Authentication passthru.
身份验证通道。
http://localhost:3000/users/auth/googleworks.How do i fix the link?http://localhost:3000/users/auth/google
config.omniauth :google_oauth2,
"GOOGLE_CLIENT_ID",
"GOOGLE_CLIENT_SECRET",
{ name: "google" }
Works just fine to change the provider name.可以很好地更改提供程序名称。 2 caveats
2 警告
google
, make sure your callback URL (in the google developer console) uses google
google
,确保您的回调 URL(在 google 开发者控制台中)使用google
Test App: https://github.com/trh/devise_omniauth_google测试应用: https ://github.com/trh/devise_omniauth_google
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.