您好,有一个使用 Linkedin 身份验证的应用程序,它曾经可以正常工作。今天我收到用户抱怨说他们在点击 Linkedin 登录时看到:Not found. Authentication passthru.
。它将他们带到页面:http://XXXXX/users/auth/linkedin?locale=en
当我检查日志时,我得到:
Started GET "/users/auth/linkedin?locale=en" for ::1 at 2021-07-12 18:04:13 +0800
Processing by OmniauthCallbacksController#passthru as HTML
Parameters: {"locale"=>"en"}
Rendering text template
Rendered text template (0.0ms)
Completed 404 Not Found in 3ms (Views: 0.9ms | ActiveRecord: 0.3ms)
我的控制器看起来像:
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
def linkedin
@user = User.connect_to_linkedin(request.env["omniauth.auth"],current_user)
if @user.persisted?
flash[:notice] = I18n.t "devise.omniauth_callbacks.success"
sign_in_and_redirect @user, :event => :authentication
else
session["devise.linkedin_uid"] = request.env["omniauth.auth"].except("extra")
redirect_to new_user_registration_url
flash[:notice] = I18n.t "devise.omniauth_callbacks.failure"
end
end
我的模型中有以下内容:
设计:database_authenticable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable, :omniauthable, :omniauth_providers => [:linkedin
user_linkedin_omniauth_authorize GET|POST /users/auth/linkedin(.:format) omniauth_callbacks#passthru
user_linkedin_omniauth_callback GET|POST /users/auth/linkedin/callback(.:format) omniauth_callbacks#linkedin
当我将 POST
方法添加到 link_to 时,我得到以下信息:
Started POST "/users/auth/linkedin?locale=en" for ::1 at 2021-07-12 21:56:18 +0800
D, [2021-07-12T21:56:18.416654 #65475] DEBUG -- omniauth: (linkedin) Request phase initiated.
W, [2021-07-12T21:56:18.417955 #65475] WARN -- omniauth: Attack prevented by OmniAuth::AuthenticityTokenProtection
E, [2021-07-12T21:56:18.418089 #65475] ERROR -- omniauth: (linkedin) Authentication failure! authenticity_error: OmniAuth::AuthenticityError, Forbidden
Processing by OmniauthCallbacksController#failure as HTML
其他东西
你知道这个突如其来的问题背后的原因是什么吗? 几天前我做了一次捆绑更新,开始出现很多错误。
到目前为止我所看到的都无济于事。