Devise, OmniAuth & Facebook: “Not found. Authentication passthru.”

前端 未结 9 1167
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-16 16:59

Trying to follow along with https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview and I\'m stumped.

I\'ve got config.omniauth :facebook, ENV[\'FB_AP

9条回答
  •  無奈伤痛
    2020-12-16 17:19

    For anyone who wants to know how to fix this, simply declare a passthru method, or do what I did, which is use action_missing (not method_missing, it is deprecated in Rails 4!) to catch all users/auth/:provider urls that omniauth uses in one method.

    For instance,

    class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
    
      def action_missing(provider)
        # Set up authentication/authorizations here, and distribute tasks
        # that are provider specific to other methods, leaving only tasks
        # that work across all providers in this method. 
      end
    

    I hope that helps anyone else who gets stuck here, I sure did.

提交回复
热议问题