Twitter (xCode/iPhone) 如何通过 oAuth 成功进行身份验证?

问题描述 投票:0回答:1

我试图以伪方式解释。我访问了以下网址:http://dev.twitter.com/pages/auth#intro

我在那里阅读了身份验证程序。我构建了一个脚本,成功地为 oAuth 属性创建了正确的签名字符串,但后来我陷入了困境。

我为“身份验证”标头字段构建了一个身份验证字符串。

OAuth oauth_callback="http%3A%2F%2Flocalhost%3A3005%2Fthe_dance%2Fprocess_callback%3Fservice_provider_id%3D11", oauth_consumer_key="GDdmIQH6jhtmLUypg82g", oauth_nonce="QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk", oauth_signature="8wUi7m5HFQy76nowoCThusfgB%2BQ%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1272323042", oauth_version="1.0"

但现在我想知道该怎么处理它。我尝试将其发送到标题中:

NSMutableURLRequest *urlRequest = [[[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"http://api.twitter.com/oauth/request_token"] cachePolicy:cachePolicy timeoutInterval:timeoutInterval] autorelease];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest addValue:authenticationString forHTTPHeaderField:@"Authorization"];

但是当检索内容时我得到:

“无法验证 oauth 签名 和代币”

有人熟悉这个错误吗?因为 oauth 签名就在那里,并且不需要令牌,因为它正在调用 request_token URL。

ios twitter oauth
1个回答
0
投票

您应该使用 xAuth 来通过 twitter 进行移动客户端身份验证...

Aral Balkan 的 google xAuthTwitterEngine,基本上他修改了 MGTwitterEngine 以使用 OAuthConsumer 开源库进行 xAuth 身份验证

干杯

© www.soinside.com 2019 - 2024. All rights reserved.