3
我使用的是Noam Ben Ari的真棒寶石Sorcery,並且存在一個我找不到的問題。Heroku上的Facebook登錄的魔法錯誤
Facebook登錄工作正常,本地服務器上,而不是在Heroku:
2011-10-03T03:50:21+00:00 app[web.1]: Started GET "/oauth/callback? provider=facebook&code=AQAJ-kjae6XnC-4R82G3DlaYseLxKFK09t9EN5Cwk-MuoctkE1iiY- tKVGM1n9YkUjhyjmhZptdOkxyytFWgFHB2RlihH1S3FdsysmKLlw7UztqczyLys_plQIRdF7YzRUi0dGqynn9j9rkqHNK7 KWqswT62usruyumS0m0d4LRCauCnPQ-SPtrNrFRdeWe0Aww" for 154.5.97.249 at 2011-10-03 03:50:21 +0000
2011-10-03T03:50:21+00:00 app[web.1]: Processing by OauthsController#callback as HTML
2011-10-03T03:50:21+00:00 app[web.1]: Parameters: {"provider"=>"facebook", "code"=>"AQAJ-kjae6XnC-4R82G3DlaYseLxKFK09t9EN5Cwk-MuoctkE1iiY- tKVGM1n9YkUjhyjmhZptdOkxyytFWgFHB2RlihH1S3FdsysmKLlw7UztqczyLys_plQIRdF7YzRUi0dGqynn9j9rkqHNK7 KWqswT62usruyumS0m0d4LRCauCnPQ-SPtrNrFRdeWe0Aww"}
2011-10-03T03:50:21+00:00 app[web.1]: Completed 500 Internal Server Error in 841ms
0-03T03:50:21+00:00 app[web.1]:
2011-10-03T03:50:21+00:00 app[web.1]: NoMethodError (undefined method 'load_from_provider' for #<Class:0x00000003fd4190>):
2011-10-03T03:50:21+00:00 app[web.1]: app/controllers/oauths_controller.rb:12:in 'callback'
2011-10-03T03:50:21+00:00 app[web.1]:
2011-10-03T03:50:21+00:00 app[web.1]:
2011-10-03T03:50:21+00:00 app[web.1]: cache: [GET /oauth/callback?provider=facebook&code=AQAJ-kjae6XnC-4R82G3DlaYseLxKFK09t9EN5Cwk-MuoctkE1iiY-tKVGM1n9YkUjhyjmhZptdOkxyytFWgFHB2RlihH1S3FdsysmKLlw7UztqczyLys_plQIRdF7YzRUi0dGqynn9j9rkqHNK7KWqswT62usruyumS0m0d4LRCauCnPQ-SPtr
我使用his own sample code on Rails的3.1.0,0.6.1法術。
這裏是罪魁禍首控制器:
class OauthsController < ApplicationController
skip_before_filter :require_login
def oauth
login_at(params[:provider])
end
def callback
provider = params[:provider]
if @user = login_from(provider) # <<<< this is the faulty line #12
redirect_to root_path, :notice => "Logged in from #{provider.titleize}!"
else
begin
@user = create_from(provider)
reset_session # protect from session fixation attack
login_user(@user)
redirect_to root_path, :notice => "Logged in from #{provider.titleize}!"
rescue
redirect_to root_path, :alert => "Failed to login from #{provider.titleize}!"
end
end
end
end
它可以在本地服務器上的罰款。除了閱讀服務器上的Heroku日誌之外,我是否有任何方法可以跟蹤錯誤?
您可能需要更新您的Facebook應用程序的回調URL以使其工作。或者,爲開發,分期和製作創建一個單獨的Facebook應用程序。 – royalGhost