Omniauth和Foursquare无法正常工作
问题描述:
因此,我使用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
答
Foursquare不应该传回秘密,只是令牌。当您在开发者网站上注册您的应用程序时,foursquare提供的foursquare密钥和秘密将通过foursquare提供给您。您必须在omniauth.rb使用这些值
答
的Twitter使用OAuth 1.0和Foursquare使用2.0
这可能是你的问题有
也许张贴一些代码? – Simpleton 2012-02-08 13:55:12
完成。没想到这是必要的,因为它是基本的代码,Twitter在这方面工作得很好。 – Synthesezia 2012-02-08 17:13:31
如果没有您的omniauth版本以及您收到的错误代码,诊断非常困难。 – Simpleton 2012-02-08 21:49:10