【问题标题】:having trouble using facebook omniauth使用 facebook omniauth 时遇到问题
【发布时间】:2012-09-14 16:45:37
【问题描述】:

我正在尝试通过 facebook 进行身份验证,我有一个 sinatra 应用程序可以在 twitter 上正常工作。

app.rb

use OmniAuth::Builder do
provider :twitter, 'xxx', 'yyy'
provider :facebook, 'xxx', 'yyy', :redirect_uri => 'http://localhost:9393/auth/facebook'
end

我在我的视图中引用了 facebook 链接,例如,

     %a{:href=>"/auth/twitter"} Sign In To Twitter
     %a{:href=>"/auth/facebook"} Sign In To Facebook

我被退回

https://graph.facebook.com/oauth/authorize?response_type=code&client_id=268504329935589&redirect_uri=http%3A%2F%2F0.0.0.0%3A9393%2Fauth%2Ffacebook%2Fcallback&state=a88cbf5f83b2faeac173f23138440cddf48cd5faf0039fe6&scope=email

看起来像

{
"error": {
  "message": "Invalid redirect_uri: Given URL is not allowed by the Application      configuration.",
  "type": "OAuthException",
  "code": 191
   }
}

据我所知,我的设置看起来是正确的。很多帖子都关于这个问题与 facebook 和应用程序注册的 url 相关联。

在 facebook 上,此应用注册为

Site URL
http://localhost:9393/
Site Domain
http://localhost:9393/

谢谢。

【问题讨论】:

    标签: ruby facebook sinatra


    【解决方案1】:

    我居然找到了答案,

    App Domains: localhost/Website with Facebook Login: http://localhost:9393/?

    本地主机上的/?(网站w fb登录)是重要的细节

    【讨论】:

      【解决方案2】:

      试试应用域:http://localhost/

      它在 Rails 中为我工作

      Site URL:    http://localhost:3000/
      
      App Domains: http://localhost/
      

      【讨论】:

        【解决方案3】:

        我通常在 facebook 中注册一个开发应用程序并将 redirect_uri 添加到我的主机文件中。通常是这样的:

        127.0.0.1 dev.mycoolapp.com
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2017-11-14
          • 2014-12-08
          • 1970-01-01
          • 2011-10-02
          • 1970-01-01
          • 2016-08-04
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多