因此,我使用Omniauth與Twitter和Foursquare等用戶進行身份驗證。 Twitter工作正常,但Foursquare似乎沒有回報祕密。Omniauth和Foursquare無法正常工作
任何人都知道發生了什麼問題?
下面是創建在控制器的動作是,Foursquare通過用戶返回到這一點,但正如我所說,這是沒有得到的祕密,只是令牌
def create
omniauth = request.env["omniauth.auth"]
unless current_user.authentications.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])
current_user.apply_omniauth(omniauth)
current_user.save
end
flash[:notice] = "Authentication Successfull"
redirect_to authentications_url
end
這裏是適用omniauth方法:
def apply_omniauth(omniauth)
authentications.build(
:provider => omniauth['provider'],
:uid => omniauth['uid'],
:token => omniauth['credentials']['token'],
:secret => omniauth['credentials']['secret']
)
end
也許張貼一些代碼? – Simpleton 2012-02-08 13:55:12
完成。沒想到這是必要的,因爲它是基本的代碼,Twitter在這方面工作得很好。 – Synthesezia 2012-02-08 17:13:31
如果沒有您的omniauth版本以及您收到的錯誤代碼,診斷非常困難。 – Simpleton 2012-02-08 21:49:10