【问题标题】:How do I correctly set up Omniauth + Devise + multiple providers如何正确设置 Omniauth + Devise + 多个提供商
【发布时间】:2015-08-27 21:25:53
【问题描述】:

我的 Facebook 身份验证有效。但是,我的 twitter 登录仅适用于 localhost。我的谷歌根本不工作。 对于谷歌,我得到了错误:

400. That’s an error.
Error: redirect_uri_mismatch
The redirect URI in the request: http://unstarv.herokuapp.com/users/auth/google_oauth2/callback did not match a registered redirect URI.

对于 Twitter,我在 heroku 上的生产中遇到了类似的问题,尽管 localhost 适用于 Twitter 登录。

我在 twitter 和 google 应用程序中设置的重定向 URI 是:

  http://unstarv.herokuapp.com

虽然我在尝试登录这些应用程序后得到的 URL 是:

https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=XXXXXXXXXXXXXXXXXXXXX
http://unstarv.herokuapp.com/users/auth/twitter/callback?oauth_token=XXXXXXXXXXXXXXXXXXXXX

我是否正确设置了重定向和回调 URI?为什么 Twitter 登录在 localhost 上有效,但在 heroku 上无效? 谢谢!!!

【问题讨论】:

  • 您是否在他们的控制台中为 google 设置了回调 uri?例如http://unstarv.herokuapp.com/users/auth/google_oauth2/callback
  • 您的设计初始化程序中有任何配置吗?

标签: ruby-on-rails heroku twitter devise


【解决方案1】:

你应该在你的谷歌控制台中添加这个

http://unstarv.herokuapp.com/users/auth/google_oauth2/callback

在 Twitter 上我设置了

http://unstarv.herokuapp.com/ 作为回调 URL

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-02-10
    • 1970-01-01
    • 1970-01-01
    • 2015-12-09
    • 2011-06-30
    • 1970-01-01
    • 2016-02-03
    相关资源
    最近更新 更多