Rails omniauth-facebook未解决的问题

Max*_*s S 10 ruby-on-rails omniauth facebook-javascript-sdk

目前的omniauth-facebook似乎有一些问题,我想知道是否有人对它们有答案.

第一个问题是无效的凭证问题.由于此问题,我无法使用客户端授权登录我的应用程序.但是,这可以通过将facebook-omniauth降级到1.4.0版本来解决.(参考)

但是,现在我遇到第二个问题,NoAuthorizationCodeError,错误消息:

OmniAuth Strategies Facebook NoAuthorizationCodeError 
(must pass either a `code` parameter or a signed request 
(via `signed_request` parameter):
Run Code Online (Sandbox Code Playgroud)

这是在这里被问到的,但是接受的答案建议再次实际升级到1.4.1版本,这将使先前的无效凭证问题再次发生.所以这对我来说不是一个选择.

NoAuthorizationCodeError当我尝试通过Internet Explorer登录Facebook iFrame(从应用程序中心搜索我的应用程序)内的应用程序时,会发生这种情况.在chrome或firefox上一切正常.还有一个github问题确切地指出了这个问题,但还没有人提出答案.我也尝试降级到omniauth-facebook 1.3.0版本,但它没有任何区别.我也尝试传递signed_request如下参数:

window.location = '/auth/facebook/callback', 
{ signed_request: response.authResponse.signedRequest }
Run Code Online (Sandbox Code Playgroud)

但是,它没有任何区别(在IE上,错误仍然存​​在),我不确定这是否是将代码作为参数传递的正确方法(我该如何检查?)

我假设我的设置没有问题.我真的很感激这方面的任何帮助.

更新:

我升级到1.4.1版本没有无效的凭据问题,但当我通过Internet Explorer访问Facebook内的应用程序时仍然会出现NoAuthorizationCodeError.检查我的Github 问题.

更新:

我降级到1.4.0版本,并添加了signedRequest params.

<script>
function login() {
  FB.login(function(response) {
    if (response.authResponse) {
      window.location = '/auth/facebook/callback?' + $.param({ signed_request: response.authResponse.signedRequest })
    } 
  }, {scope: 'email,publish_stream,publish_actions'});
}
</script>
Run Code Online (Sandbox Code Playgroud)

日志中没有错误或警报,一切都按预期工作.但是,如果我通过Internet Explorer在Facebook iFrame中登录,即使在回调阶段启动后它也不会登录.我想原来的问题已经解决但我无法弄清楚如何在没有任何错误消息的情况下调试它.

问题:当我点击Facebook iFrame中的"使用Facebook登录"我的应用程序与Internet Explorer时,我没有在授权过程完成时登录.这个问题只发生在那个特定的环境中,我很难弄清楚原因.

2013-02-22T01:10:40+00:00 app[web.1]: Started GET "/auth/facebook/callback?signed_request=LONGSTRING" for 200.1.102.103 at 2013-02-22 01:10:40 +0000
2013-02-22T01:10:40+00:00 app[web.1]: (facebook) Callback phase initiated.
2013-02-22T01:10:40+00:00 app[web.1]: Processing by SessionsController#create_facebook as HTML
2013-02-22T01:10:40+00:00 app[web.1]:   Parameters: {"signed_request"=>"LONGSTRING", "provider"=>"facebook"}
2013-02-22T01:10:40+00:00 app[web.1]:   User Load (1.6ms)  SELECT "users".* FROM "users" WHERE "users"."provider" = 'facebook' AND "users"."uid" = 'MYUID' LIMIT 1
2013-02-22T01:10:40+00:00 app[web.1]:    (0.8ms)  BEGIN
2013-02-22T01:10:40+00:00 app[web.1]:   User Exists (1.0ms)  SELECT 1 AS one FROM "users" WHERE ("users"."name" = 'MYNAME' AND "users"."id" != 3) LIMIT 1
2013-02-22T01:10:40+00:00 app[web.1]:    (0.9ms)  COMMIT
2013-02-22T01:10:40+00:00 app[web.1]: Redirected to http://MYAPP.COM
2013-02-22T01:10:40+00:00 app[web.1]: Completed 302 Found in 10ms (ActiveRecord: 4.2ms)
Run Code Online (Sandbox Code Playgroud)

同样,在任何其他环境中,授权在所有浏 当我尝试通过Internet Explorer登录Facebook时,才会出现此问题.

我的环境:omniauth-facebook 1.4.0,omniauth 1.1.1,oauth2 0.8.0,Rails 3.2.11

由于最新版本中的凭据无效错误,我故意将omniauth-facebook从1.4.1降级到1.4.0 .

My *_*God 0

fastcatch这篇SO 帖子中,在getting-more information-from-omniauth-exceptions的帮助下指出,

... OmniAuth strategies [...], if they encounter a problem, call the method fail! and pass in a symbol describing the problem like :invalid_credentials and the exception they encountered. The fail! method ends up calling OmniAuth.config.on_failure and passing in the Rack environment (after doing a few other things like sticking the exception into the environment...