我正在使用omniAuth + facebook身份验证
@user = User.find_for_facebook_oauth(request.env["omniauth.auth"])
if @user.persisted?
@user.reload
sign_in @user, :event => :authentication
redirect_to after_sign_in_path_for(@user)
set_flash_message(:notice, :success, :kind => "Facebook") if is_navigational_format?
else
session["devise.facebook_data"] = request.env["omniauth.auth"]
redirect_to new_user_registration_url
end
在facebook登录后,用户登陆根网址,当尝试打开/帐户/个人资料时会发出未经授权的错误。但几秒后/帐户/配置文件变得可访问。为什么会有延迟?
class AccountController < ApplicationController
layout false
def profile
if !current_user
render status: 401
return
end
end