简体   繁体   English

Rails 4 OmniAuth Facebook NoAuthorizationErrorCode

[英]Rails 4 OmniAuth Facebook NoAuthorizationErrorCode

I'm running into an issue with facebook login in once I deploy to Heroku. 部署到Heroku后,我遇到了Facebook登录问题。 I disabled sandbox mode by setting my "making the app available to the public". 我通过设置“将应用程序公开”来禁用沙箱模式。 I can't quite tell if this is a facebook settings issue or an issue with my app. 我不太清楚这是Facebook设置问题还是我的应用程序问题。 I've been searching hard for an answer and haven't been able to find any. 我一直在努力寻找答案,却找不到任何答案。

Heroku Logs: Heroku日志:

heroku[router]: at=info method=GET path="/auth/facebook/callback"

OmniAuth::Strategies::Facebook::NoAuthorizationCodeError (must pass either a `code` parameter or a signed request (via `signed_request` parameter or a `fbsr_XXX` cookie))

I've tried some other strategies such as switching to gem "omniauth-facebook", "~> 1.4.1" but ran into a CSRF issue there. 我尝试了其他一些策略,例如切换到gem“ omniauth-facebook”,“〜> 1.4.1”,但是在那里遇到了CSRF问题。

I'm using: 我正在使用:

  * oauth2 (0.9.4)
  * omniauth (1.2.2)
  * omniauth-facebook (1.4.1)
  * omniauth-oauth2 (1.1.2)

My routes are pretty standard 我的路线很标准

  get 'auth/:provider/callback', to: 'sessions#create'
  get 'auth/failure', to: redirect('/')
  get 'signout', to: 'sessions#destroy', as: 'signout'

And finally my JS 最后是我的JS

 $scope.login = function() {
    FB.login(function(response) {
      console.log(response);
      return window.location = '/auth/facebook/callback';
    })
  }

I'm embarrassed to say it was not pushing my private and secret keys to production. 我很尴尬地说这不是将我的私钥和秘密密钥推向生产环境。 I hope this helps someone else. 我希望这可以帮助其他人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM