我使用omniauth-facebook 1.4.1 来使用facebook 登录。有错误
Could not authorize you from Facebook because "Csrf detected".
似乎人们通过将omniauth-facebook 降级到1.4.0 来解决这个问题。我试过了,但现在有错误
The action 'facebook' could not be found for Devise::OmniauthCallbacksController.
我有路线
devise_for :users, :controllers => { :omniauth_callbacks => :omniauth_callbacks}
并且 omniauth_callbacks 位于控制器目录中:
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
def facebook
# You need to implement the method below in your model
@user = User.find_for_facebook_oauth(env["omniauth.auth"], current_user)
if @user.persisted?
flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Facebook"
sign_in_and_redirect @user, :event => :authentication
else
session["devise.facebook_data"] = env["omniauth.auth"]
redirect_to new_user_registration_url
end
end
end
有什么建议么?