Rails + omniauth + facebook - csrf detected

后端 未结 3 1060
庸人自扰
庸人自扰 2021-01-06 04:01

I\'m working on logging in a site via existing facebook account. So I registered a facebook application and stored api and secret

相关标签:
3条回答
  • 2021-01-06 04:09

    I solved this issue when I deleted 'omniauth.rb' because I already have this config below in devise.rb:

      config.omniauth :facebook, ENV["FB_ID"], ENV["FB_SECRET"],
        scope: 'email',
        info_fields: 'email, first_name, last_name',
        image_size: 'large',  # 50x50, guaranteed ratio
        secure_image_url: true
    

    Remember to restart the sever to test.

    0 讨论(0)
  • 2021-01-06 04:26

    I had this issue as well, turns out I still had "sandbox" mode enabled in my Facebook application. Sounds like this may be your issue as well :)

    If not, could you please post any related log entries?

    0 讨论(0)
  • 2021-01-06 04:28

    For me, I needed to add provider_ignores_state: true to my Omniauth config:

    config.omniauth :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_APP_SECRET'], {
      strategy_class: OmniAuth::Strategies::Facebook,
      provider_ignores_state: true
    }
    

    This is on omniauth-facebook gem version 1.6.0.

    There is more info also at https://github.com/mkdynamic/omniauth-facebook/issues/73

    0 讨论(0)
提交回复
热议问题