我正在关注文档中的所有内容:http: //dev.twitter.com/pages/sign_in_with_twitter
我正在开发一个 Rails 应用程序,这就是我的代码的样子(下面的代码使用 oauth ruby gem):
@consumer=OAuth::Consumer.new("key" , "secret", {:site=>"https://
api.twitter.com"})
@request_tok...@consumer.get_request_token(:oauth_callback =>
"#{SITE_BASE}/callback")
redirect_to
@request_token.authorize_url().gsub("authorize","authenticate")
生成的 URL 是: https ://api.twitter.com/oauth/authenticate?oauth_token=_REQUEST_TOKEN_
我已经登录到 twitter.com 并已授权该应用程序。但它显示授权屏幕:授权 Twoo Dev 使用您的帐户?
我所做的就是重新加载页面,它会将我带到我的应用程序的回调。
我也使用了omniauth gem并且遇到了同样的问题,因此我转向了oauth。
请提出可能出了什么问题。
问候,阿迪亚
以下是身份验证 url 的标头信息:
Response Headersview source
Date Mon, 20 Jun 2011 00:48:13 GMT
Server hi
Status 200 OK
X-Transaction
Etag ""-gzip
X-Frame-Options SAMEORIGIN
Last-Modified Mon, 20 Jun 2011 00:48:13 GMT
X-Runtime 0.06452
Content-Type text/html; charset=utf-8
Pragma no-cache
X-Revision DEV
Expires Tue, 31 Mar 1981 05:00:00 GMT
Cache-Control no-cache, no-store, must-revalidate, pre-check=0, post-
check=0
X-MID
Set-Cookie lang=en; path=/ lang=en; path=/ _twitter_sess=;
domain=.twitter.com; path=/; HttpOnly
Vary Accept-Encoding
Content-Encoding gzip
Content-Length 2936
Keep-Alive timeout=15, max=100
Connection Keep-Alive