开发者

Twitter (xCode/iPhone) How can I successfully authenticate through oAuth?

I am trying to explain in pseudo. I followed the following URL: http://dev.twitter.com/pages/auth#intro

There I read the authentication procedure. I builded a script that successfully creates a proper signature string for the oAuth properties. But then I am stuck.

I build an Authentication string for the 'Authentication' header field.

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"

But now I am wondering what to do with it. I try to sent it in the header

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"];

But when retrieving the content I get:

"Failed to validate o开发者_高级运维auth signature and token"

Anyone familiar with this error? Because the oauth signature is in there and the token should not be required because it is calling the request_token URL.


you should use xAuth for mobile clients' authentication with twitter...

google xAuthTwitterEngine by Aral Balkan, basically he modified MGTwitterEngine to do the xAuth authentication using the OAuthConsumer open source library

cheers

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜