OmniAuth :: Strategies :: OAuth2 :: CallbackError происходит - PullRequest
0 голосов
/ 04 июля 2019

Я работаю над проектом рельсов, но omniauth-linkedin-oauth2 не сработает!У меня есть ошибка, как показано ниже.

   Authentication failure! csrf_detected: OmniAuth::Strategies::OAuth2::CallbackError, csrf_detected | CSRF detected

apps / controllers / omniauth_controller.rb

    class OmniauthCallbacksController < Devise::OmniauthCallbacksController
        def facebook
            @user = User.from_omniauth(request.env["omniauth.auth"].except("extra"))

            if @user.persisted?
                sign_in_and_redirect @user, event: :authentication
            else
                session["devise.user_attributes"] = @user.attributes
                redirect_to new_user_registration_url
            end
        end

        def linkedin
            @user = User.from_omniauth(request.env["omniauth.auth"].except("extra"))

            if @user.persisted?
                sign_in_and_redirect @user, event: :authentication
            else
                session["devise.user_attributes"] = @user.attributes
                redirect_to new_user_registration_url
            end
        end
    end

config / initializers / devise.rb

  config.omniauth :linkedin,
    Rails.application.credentials[Rails.env.to_sym][:linkedin][:client_id],
    Rails.application.credentials[Rails.env.to_sym][:linkedin][:client_secret],
    provider_ignores_state: true
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...