开发者

How do I authenticate a Twitter user and access the API without leaving my iPhone app?

开发者 https://www.devze.com 2022-12-28 04:58 出处:网络
I\'d like to allow users to send out Tweets from my iPhone app. That\'s all the functionality I need at the moment.

I'd like to allow users to send out Tweets from my iPhone app. That's all the functionality I need at the moment.

From what I know of the Twitter API, there's a standard authentication mechanism, which allows the developer to include the user's name and password in the request string that the application sends to Twitter. This method will no longer be supported come June 30, 2010.

Given the timeframe, the better other choice is oAuth. One of the caveats of oAuth is that it requires a UIWebView to pop up within the app to allow the user to enter his o开发者_JS百科r her credentials or a PIN number.

None of the Twitter apps on my phone do this, however: Tweetie, TweetDeck and Twitterific. I assume they're using the first authentication method, but it seems like Twitter wouldn't deprecate an API that would hurt the user experience across the board.

There must be an alternative method--what am I missing?


Twitter provides XAuth for non-web apps.

https://dev.twitter.com/docs/oauth/xauth


Just because you have a UIWebView does not mean it has to be visible. You can probably use - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script; or some other trickery to submit a form without bothering the user.

Just make sure you give yourself the option of downloading an updated script from your server.


Note that http://dev.twitter.com/doc/post/oauth/access_token is the latest documentation.

0

精彩评论

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