<?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>blackcj.com &#187; Credentials</title>
	<atom:link href="http://www.blackcj.com/blog/tag/credentials/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blackcj.com/blog</link>
	<description>Cutting edge development with Adobe Flex, ActionScript and AIR</description>
	<lastBuildDate>Thu, 15 Dec 2011 01:01:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Validate Twitter Credentials in AIR</title>
		<link>http://www.blackcj.com/blog/2008/12/21/validate-twitter-credentials-in-air/</link>
		<comments>http://www.blackcj.com/blog/2008/12/21/validate-twitter-credentials-in-air/#comments</comments>
		<pubDate>Sun, 21 Dec 2008 22:21:42 +0000</pubDate>
		<dc:creator>Chris Black</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Authenticate]]></category>
		<category><![CDATA[Credentials]]></category>
		<category><![CDATA[Password]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Username]]></category>

		<guid isPermaLink="false">http://www.blackcj.com/blog/?p=131</guid>
		<description><![CDATA[Problem: Your AIR application needs to validate the username / password and handle failure gracefully within the application. If the user enters the wrong information you do not want them to be prompted with a windows prompt asking them to enter their Twitter username / password. If the application needs to hold on to the [...]]]></description>
			<content:encoded><![CDATA[<p>Problem:<br />
Your AIR application needs to validate the username / password and handle failure gracefully within the application.  If the user enters the wrong information you do not want them to be prompted with a windows prompt asking them to enter their Twitter username / password.  If the application needs to hold on to the credentials for any reason the windows authentication to the API will break the AIR application.</p>
<p>"The server twitter.com at Twitter API requires a username and password."</p>
<div id="attachment_132" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.blackcj.com/blog/wp-content/uploads/2008/12/verifytwittercreds.jpg"><img src="http://www.blackcj.com/blog/wp-content/uploads/2008/12/verifytwittercreds-300x269.jpg" alt="Windows Authentication Pop-up Message." title="verifytwittercreds" width="300" height="269" class="size-medium wp-image-132" /></a><p class="wp-caption-text">Windows Authentication Pop up message.</p></div>
<p>Solution:<br />
The URLRequest object has a property called 'authenticate' that must be set to false. </p>
<div class="igBar"><span id="lactionscript-2"><a href="#" onclick="javascript:showPlainTxt('actionscript-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">Actionscript:</span>
<div id="actionscript-2">
<div class="actionscript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">/**</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> * </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> * Setting result.authenticate to false prevents the operating system from</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> * taking over and prompting the user to authenticate.&nbsp; It allows the AIR</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> * application to take the correct action.</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> *</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"> */</span>&nbsp;&nbsp; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> twitterRequest <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">url</span> : <span style="color: #0066CC;">String</span><span style="color: #66cc66;">&#41;</span>:URLRequest</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> result:URLRequest = <span style="color: #000000; font-weight: bold;">new</span> URLRequest <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">url</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">this</span>.<span style="color: #006600;">authorizationHeader</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; result.<span style="color: #006600;">authenticate</span> = <span style="color: #000000; font-weight: bold;">false</span>;&nbsp; <span style="color: #808080; font-style: italic;">// &lt;--------- Most Important Line of Code!!!!</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; result.<span style="color: #006600;">requestHeaders</span> = <span style="color: #66cc66;">&#91;</span><span style="color: #0066CC;">this</span>.<span style="color: #006600;">authorizationHeader</span><span style="color: #66cc66;">&#93;</span>;&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">return</span> result;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Most of the code from the example attached below is from the Google code repository:<br />
<a href="http://code.google.com/p/twitterscript/"></p>
<p>http://code.google.com/p/twitterscript/</a></p>
<p>Here are the source files to an example AIR application that uses actionscript to verify Twitter credentials without prompting a windows box on failure:</p>
<p><a href="http://www.blackcj.com/VerifyTwitterCreds/VerifyTwitterCreds.zip">Source Files</a></p>
<p>I would like to give credit to Clayton (<a href="http://twitter.com/file_cabinet">file_cabinet</a>) for coming up with the solution to this problem.  Thanks Clayton!<br />
<br/></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blackcj.com/blog/2008/12/21/validate-twitter-credentials-in-air/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.459 seconds -->

