我已经设置设计来处理我的身份验证,并且还使用omniauth 进行第三方身份验证,这对我也很有效。我可以通过在我的用户模型中设置此方法来检索名称、昵称
def self.from_omniauth(auth)
where(auth.slice(:provider, :uid)).first_or_create do |user|
user.provider = auth.provider
user.uid = auth.uid
user.username = auth.info.nickname
user.username = auth.info.first_name
user.email = auth.info.email
user.photo = auth.info.image
end
end
每当我尝试通过以下方式验证用户身份时,我都会使用回形针来处理我的图像处理
user.photo = auth.info.image
我收到这样的错误
Paperclip::AdapterRegistry::NoHandlerError in OmniauthCallbacksController#facebook
No handler found for "http://graph.facebook.com/100006033401739/picture?type=square"
无论如何,还是有什么不对劲?
我的 OmniauthCallbacksController 控制器是这样的:
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
def all
user = User.from_omniauth(request.env["omniauth.auth"])
if user.persisted?
flash.notice = "Signed in!"
sign_in_and_redirect user
else
session["devise.user_attributes"] = user.attributes
redirect_to new_user_registration_url
end
end
alias_method :twitter, :all
alias_method :facebook, :all
alias_method :google_oauth2, :all
end