<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Null Agenda &#187; OAuth</title>
	<atom:link href="http://nullagenda.com/tag/oauth/feed" rel="self" type="application/rss+xml" />
	<link>http://nullagenda.com</link>
	<description>a little bit of everything.</description>
	<lastBuildDate>Mon, 01 Aug 2011 02:39:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>OAuthConsumer and Twitter</title>
		<link>http://nullagenda.com/oauthconsumer-and-twitter-114</link>
		<comments>http://nullagenda.com/oauthconsumer-and-twitter-114#comments</comments>
		<pubDate>Thu, 30 Jul 2009 06:30:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[OAuth]]></category>
		<category><![CDATA[OAuthConsumer]]></category>
		<category><![CDATA[Objective C]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://nullagenda.com/?p=114</guid>
		<description><![CDATA[If you've attempted to develop any apps that utilize Twitter's API, you're probably familiar with the whole OAuth stuff. If you're developing your app for the Mac platform and have used the OAuthConsumer you might have noticed that your app broke (at least sending status updates) a couple days ago because of an unannounced security patch Twitter pushed out.]]></description>
			<content:encoded><![CDATA[<p>So it&#8217;s been a while since I&#8217;ve posted anything here, and I apologize for that&#8230; I&#8217;ll have part II of my last post here very soon. If you&#8217;ve attempted to develop any apps that utilize <a href="http://apiwiki.twitter.com/">Twitter&#8217;s API</a>, you&#8217;re probably familiar with the whole OAuth stuff. If you&#8217;re developing your app for the Mac platform and have used the <a href="http://code.google.com/p/oauthconsumer/">OAuthConsumer</a> you might have noticed that your app broke (at least sending status updates) a couple days ago because of an unannounced security patch Twitter pushed out.</p>
<p>I spent many hours trying to figure out what was going on, and finally was able to fix the issue. Assuming you added a &#8216;verifier&#8217; property to <strong>OAToken</strong>, a simple check for this property and excluding the <em>oauth_verifier </em>parameter from the <em>oauthToken</em> string in the prepare method in <strong>OAMutableURLRequest</strong> is all that is necessary. OAuthConsumer passed the <em>oauth_verifier</em> parameter when a token key existed (which is when status updates are sent among other requests). Even though this parameter was an empty string, accessing a user&#8217;s protected resources with it present caused Twitter to complain.</p>
<p>so here is what I did&#8230;<br />
<code><br />
</code></p>
<p><code></p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 130px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">NSString *oauthToken;</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 130px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">if ([token.key isEqualToString:@""])</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 130px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">oauthToken = @""; // not used on Request Token transactions</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 130px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>else if(token.verifier == nil || [token.verifier isEqualToString:@""])</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 130px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><span style="white-space: pre;"> </span>oauthToken = [NSString stringWithFormat:@"oauth_token=\"%@\", ", [token.key URLEncodedString]];</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 130px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">else</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 130px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">oauthToken = [NSString stringWithFormat:@"oauth_token=\"%@\", oauth_verifier=\"%@\", ", [token.key URLEncodedString], [token.verifier URLEncodedString]];</div>
<p><em>NSString *oauthToken;</em></p>
<p><em> if ([token.key isEqualToString:@""])</em></p>
<p><em> oauthToken = @""; // not used on Request Token transactions</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>else if(token.verifier == nil || [token.verifier isEqualToString:@""])</em></p>
<p><span style="white-space: pre;"><em> </em></span><em>oauthToken = [NSString stringWithFormat:@"oauth_token=\"%@\", ", [token.key URLEncodedString]];</em></p>
<p><em> else</em></p>
<p></code></p>
<p><code><em> oauthToken = [NSString stringWithFormat:@"oauth_token=\"%@\", oauth_verifier=\"%@\", ", [token.key URLEncodedString], [token.verifier URLEncodedString]];</em></code></p>
<p>Basically I added an else-if that set the <em>oauthToken</em> string without adding the <em>oauth_verifier</em> parameter. Hope this helps others!</p>
<h3  class="related_post_title">other posts that might interest you...</h3><ul class="related_post"><li><a href="http://nullagenda.com/so-i-developed-my-first-mac-app-81" title="So I Developed My First Mac App&#8230;">So I Developed My First Mac App&#8230;</a></li><li><a href="http://nullagenda.com/looking-for-beta-testers-198" title="Looking for Beta Testers">Looking for Beta Testers</a></li><li><a href="http://nullagenda.com/mac-design-awards-193" title="Mac Design Awards">Mac Design Awards</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://nullagenda.com/oauthconsumer-and-twitter-114/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

