<?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>Jozef Chúťka&#039;s blog &#187; Facebook</title>
	<atom:link href="http://blog.yoz.sk/tag/facebook/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.yoz.sk</link>
	<description>My life, my work</description>
	<lastBuildDate>Tue, 31 Jan 2012 12:40:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Authorizing Facebook Applications in Android</title>
		<link>http://blog.yoz.sk/2010/10/authorizing-facebook-applications-in-android/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=authorizing-facebook-applications-in-android</link>
		<comments>http://blog.yoz.sk/2010/10/authorizing-facebook-applications-in-android/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 14:53:26 +0000</pubDate>
		<dc:creator>Jozef Chúťka</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Flash / Flex]]></category>
		<category><![CDATA[FacebookOAuthGraph]]></category>
		<category><![CDATA[StageWebView]]></category>

		<guid isPermaLink="false">http://blog.yoz.sk/?p=2481</guid>
		<description><![CDATA[Hold on, this is going to be fast and smooth! I am playing with an Android Emluator for a few days now. One of the challenges was to mount FacebookOAuthGraph lib into Android. It turned out to be 1 hour task. Thanks to Flash-Core article and sHTiF and StageWebView. Long live AIR for Android! Follow [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.yoz.sk/wp-content/uploads/androidfacebook.png" alt="" title="androidfacebook" width="200" height="100" class="alignleft size-full wp-image-2482" /></p>
<p>Hold on, this is going to be fast and smooth! I am playing with an Android Emluator for a few days now. One of the challenges was to mount <a href="http://blog.yoz.sk/facebookoauthgraph/">FacebookOAuthGraph</a> lib into Android. It turned out to be 1 hour task. Thanks to <a href="http://blog.flash-core.com/?p=233">Flash-Core article</a> and <a href="http://blog.flash-core.com/?author=2">sHTiF</a> and <a href="http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/media/StageWebView.html">StageWebView</a>. Long live AIR for Android! <img src='http://blog.yoz.sk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Follow the article for codes:</p>
<p><span id="more-2481"></span></p>
<p>You do not need a callback.html file, as in <a href="http://blog.yoz.sk/2010/09/authorizing-facebook-applications-in-air/">previous AIR example</a>, you can use non existing redirect_uri targeting correct domain + a simple extending of FacebookOAuthGraph:</p>
<pre class="brush: as3; title: ; notranslate">package
{
    import flash.display.Stage;
    import flash.events.LocationChangeEvent;
    import flash.geom.Rectangle;
    import flash.media.StageWebView;

    import onboard.Controller;

    public class FacebookAndroid extends FacebookOAuthGraph
    {
        public var loader:StageWebView;
        public var stage:Stage; // this is the air application Stage

        public function FacebookAndroid()
        {
            super();
        }

        override public function connect():void
        {
            var bounds:Rectangle = new Rectangle(0,0,480,480);

            loader = new StageWebView();
            loader.addEventListener(LocationChangeEvent.LOCATION_CHANGING, onLocationChanging);
            loader.addEventListener(LocationChangeEvent.LOCATION_CHANGE, onLocationChange);
            loader.stage = stage;
            loader.viewPort = bounds;
            loader.loadURL(authorizationURL);
        }

        private function onLocationChanging(event:LocationChangeEvent):void
        {
            event.preventDefault();
            loader.loadURL(event.location);
        }

        private function onLocationChange(event:LocationChangeEvent):void
        {
            var hash:String = locationExtractHash(loader.location);
            var error:String = locationExtractError(loader.location);
            if(hash)
                confirmConnection(hash);
            if(hash || error)
                destroyLoader();
        }

        protected function locationExtractHash(url:String):String
        {
            var index:int = url.indexOf(&quot;#&quot;);
            if(index &lt;= -1)
                return null;
            var hash:String = url.substr(index + 1);
            return hashToToken(hash) ? hash : null;
        }

        protected function locationExtractError(url:String):String
        {
            var index:int = url.indexOf(&quot;?&quot;);
            if(index &lt;= -1)
                return null;
            var query:String = url.substr(index + 1);
            var variables:URLVariables = new URLVariables(query);
            return variables.hasOwnProperty(&quot;error&quot;) ? variables.error : null;
        }

        private function destroyLoader():void
        {
            loader.removeEventListener(LocationChangeEvent.LOCATION_CHANGING, onLocationChanging);
            loader.removeEventListener(LocationChangeEvent.LOCATION_CHANGE, onLocationChange);
            loader.dispose();
            loader = null;
        }
    }
}</pre>
<p>How does this works? You do not need any callback.html, just generate some redirect_uri that correctly targets your domain, it can be anything, even 404.html, or asdf-foo-bar.html file that does not exist. Once the Facebook, redirects you back to the redirect_uri, the url contains access_token within url hash</p>
<pre class="brush: plain; title: ; notranslate">http://domain/whatever-or-404.html#access_token=123</pre>
<p>&#8230; now, if it does, it is parsed by locationExtractHash(), if it does not, the url contains error (user clicked Cancel button), the url contains error:</p>
<pre class="brush: plain; title: ; notranslate">http://domain/whatever-or-404.html?error_reason=user_denied&amp;error=access_denied&amp;error_description=The+user+denied+your+request.</pre>
<p>In case of error locationExtractError() parses and error. In both cases (error or access_token), the HTMLLoader window is closed and token is handled via confirmConnection(). Yeah, this way you can authorize <strong>!ANY!</strong> existing facebook application for your AIR app.</p>
<p>sHTiF also did a good job commenting all the functions, <a href="http://blog.flash-core.com/?p=233">follow his the article</a> to understand LocationChangeEvent listeners.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yoz.sk/2010/10/authorizing-facebook-applications-in-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Authorizing Facebook Applications in AIR</title>
		<link>http://blog.yoz.sk/2010/09/authorizing-facebook-applications-in-air/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=authorizing-facebook-applications-in-air</link>
		<comments>http://blog.yoz.sk/2010/09/authorizing-facebook-applications-in-air/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 12:43:53 +0000</pubDate>
		<dc:creator>Jozef Chúťka</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AIR]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Flash / Flex]]></category>
		<category><![CDATA[HTMLLoader]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[NativeWindow]]></category>
		<category><![CDATA[NativeWindowInitOptions]]></category>

		<guid isPermaLink="false">http://blog.yoz.sk/?p=2338</guid>
		<description><![CDATA[I was asked to make AIR compatibile version of FacebookOAuthGraph class. It was a nice little challenge for me, where I learn some new things about AIR. E.g. how easy it is to define the JavaScript callback directly from ActionScipt (HTMLLoader.window.methodName)&#8230; There are more ways to make authorization process work for you, I have chosen [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.yoz.sk/wp-content/uploads/airfacebook.jpg" alt="" title="airfacebook" width="200" height="100" class="alignleft size-full wp-image-2281" /></p>
<p>I was asked to make AIR compatibile version of <a href="http://blog.yoz.sk/facebookoauthgraph/">FacebookOAuthGraph</a> class. It was a nice little challenge for me, where I learn some new things <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=ProgrammingHTMLAndJavaScript_06.html">about AIR</a>. E.g. how easy it is to define the JavaScript callback directly from ActionScipt (HTMLLoader.window.methodName)&#8230; There are more ways to make authorization process work for you, I have chosen the one with popup window. In order to make FacebookOAuthGraph work for AIR, the short extending is required, instead of creating popup window from JavaScript, popup is created by HTMLLoader.createRootWindow (no ExternalInterface required)&#8230; </p>
<p><span id="more-2338"></span></p>
<p>Lets start with the main AIR Application file:</p>
<pre class="brush: xml; title: ; notranslate">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;s:WindowedApplication xmlns:fx=&quot;http://ns.adobe.com/mxml/2009&quot;
                       xmlns:s=&quot;library://ns.adobe.com/flex/spark&quot;
                       xmlns:mx=&quot;library://ns.adobe.com/flex/mx&quot;
                       applicationComplete=&quot;init()&quot;&gt;
    &lt;s:layout&gt;
        &lt;s:VerticalLayout /&gt;
    &lt;/s:layout&gt;

    ... here comes the same content as in:
    &quot;http://blog.yoz.sk/2010/05/facebook-graph-api-and-oauth-2-and-flash/&quot;
    ...
    just change redirectURI to:
    &quot;http://blog.yoz.sk/examples/FacebookOAuthGraph/aircallback.html&quot;
    ...

&lt;/s:WindowedApplication&gt;</pre>
<p>Do not bother with callback.html (you do not need any, if you do, create an empty .html file) and make your Facebook class look something like this:</p>
<pre class="brush: as3; title: ; notranslate">package
{
    import flash.display.NativeWindowInitOptions;
    import flash.events.Event;
    import flash.geom.Rectangle;
    import flash.html.HTMLLoader;
    import flash.net.URLRequest;

    public class Facebook extends FacebookOAuthGraph
    {
        public var loader:HTMLLoader;

        public function Facebook()
        {
            super();
        }

        override public function connect():void
        {
            var options:NativeWindowInitOptions = new NativeWindowInitOptions();
            var boundaries:Rectangle = new Rectangle(200,200,500,500);
            loader = HTMLLoader.createRootWindow(true, options, true, boundaries);
            loader.load(new URLRequest(authorizationURL));
            loader.addEventListener(Event.LOCATION_CHANGE, onLocationChange);
        }

        private function onLocationChange(event:Event):void
        {
            var hash:String = locationExtractHash(loader.location);
            var error:String = locationExtractError(loader.location);
            if(hash)
                confirmConnection(hash);
            if(hash || error)
                destroyLoader();
        }

        protected function locationExtractHash(url:String):String
        {
            var index:int = url.indexOf(&quot;#&quot;);
            if(index &lt;= -1)
                return null;
            var hash:String = url.substr(index + 1);
            return hashToToken(hash) ? hash : null;
        }

        protected function locationExtractError(url:String):String
        {
            var index:int = url.indexOf(&quot;?&quot;);
            if(index &lt;= -1)
                return null;
            var query:String = url.substr(index + 1);
            var variables:URLVariables = new URLVariables(query);
            return variables.hasOwnProperty(&quot;error&quot;) ? variables.error : null;
        }

        private function destroyLoader():void
        {
            loader.removeEventListener(Event.LOCATION_CHANGE, onLocationChange);
            loader.removeEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
            loader.stage.nativeWindow.close();
            loader = null;
        }
    }
}</pre>
<p>How does this works? You do not need any callback.html, just generate some redirect_uri that correctly targets your domain, it can be anything, even 404.html, or asdf-foo-bar.html file that does not exist. Once the Facebook, redirects you back to the redirect_uri, the url contains access_token within url hash</p>
<pre class="brush: plain; title: ; notranslate">http://domain/whatever-or-404.html#access_token=123</pre>
<p>&#8230; now, if it does, it is parsed by locationExtractHash(), if it does not, the url contains error (user clicked Cancel button), the url contains error:</p>
<pre class="brush: plain; title: ; notranslate">http://domain/whatever-or-404.html?error_reason=user_denied&amp;error=access_denied&amp;error_description=The+user+denied+your+request.</pre>
<p>In case of error locationExtractError() parses and error. In both cases (error or access_token), the HTMLLoader window is closed and token is handled via confirmConnection(). Yeah, this way you can authorize <strong>!ANY!</strong> existing facebook application for your AIR app.</p>
<h2>Depricated version using JavaScript in callback</h2>
<p>Keep the changes in main AIR Application file (see above), and make small changes in aircallback.html, in fact it got even simplier comparing to the original:</p>
<pre class="brush: xml; title: ; notranslate">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;sk&quot; lang=&quot;sk&quot; dir=&quot;ltr&quot;&gt;
&lt;head&gt;
	&lt;script type=&quot;text/javascript&quot;&gt;
	&lt;!--
		confirmFacebookConnection(window.location.hash);
	//--&gt;
	&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;You may now close this window.&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>&#8230; finally some method changes in FacebookOAuthGraph class:</p>
<pre class="brush: as3; title: ; notranslate">package
{
    import flash.display.NativeWindowInitOptions;
    import flash.events.Event;
    import flash.geom.Rectangle;
    import flash.html.HTMLLoader;
    import flash.net.URLRequest;

    import sk.yoz.net.FacebookOAuthGraph;

    public class Facebook extends FacebookOAuthGraph
    {
        public var loader:HTMLLoader;

        public function Facebook()
        {
            super();
        }

        override public function connect():void
        {
            var options:NativeWindowInitOptions = new NativeWindowInitOptions();
            var boundaries:Rectangle = new Rectangle(200,200,500,500);
            loader = HTMLLoader.createRootWindow(true, options, true, boundaries);
            loader.load(new URLRequest(authorizationURL));
            loader.addEventListener(Event.HTML_DOM_INITIALIZE, onDOMInit);
        }

        private function onDOMInit(event:Event):void
        {
            loader.window[jsConfirm] = confirmConnection;
        }

        override public function confirmConnection(hash:String):void
        {
            super.confirmConnection(hash);
            loader.stage.nativeWindow.close();
        }
    }
}</pre>
<p>What it does is, it pushes JavaScript callback into HTMLLoader that is called via aircallback.html JavaScript&#8230;</p>
<p>Where to go from here:</p>
<ul>
<li><a href="http://livedocs.adobe.com/flex/3/html/help.html?content=ProgrammingHTMLAndJavaScript_06.html">Making ActionScript objects available to JavaScript</a></li>
<li><a href="http://www.akbarsait.com/blog/index.cfm/2009/6/1/Creating-Windows-in-HTML-and-JavaScript-AIR-Applications">Creating Windows in HTML and JavaScript AIR Applications</a></li>
<li><a href="http://stackoverflow.com/questions/573472/how-to-access-an-iframe-in-an-adobe-air-application">How to access an iframe in an Adobe AIR application?</a></li>
<li><a href="http://blog.swfjunkie.com/2010/08/tweetr-tutorials-pinless-oauth-in-air/">Tweetr Tutorials: Pinless OAuth in AIR</a></li>
<li><a href="http://blog.flash-core.com/?p=214">AIR and authentification on Facebook</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.yoz.sk/2010/09/authorizing-facebook-applications-in-air/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Publish Your AIR Applications To Facebook</title>
		<link>http://blog.yoz.sk/2010/08/publish-your-air-applications-to-facebook/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=publish-your-air-applications-to-facebook</link>
		<comments>http://blog.yoz.sk/2010/08/publish-your-air-applications-to-facebook/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 11:19:26 +0000</pubDate>
		<dc:creator>Jozef Chúťka</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Flash / Flex]]></category>
		<category><![CDATA[badge]]></category>
		<category><![CDATA[publish]]></category>

		<guid isPermaLink="false">http://blog.yoz.sk/?p=2263</guid>
		<description><![CDATA[Hi folks! Today, while mounting some of my projects into AIR, I realized that it would be great if I could pusblish AIR badges over Facebook. You know what? That is possible! I have created a simple flex application + facebook application that, based on parameters, generates AIR badge for an app. Now its time [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.yoz.sk/wp-content/uploads/airfacebook.jpg" alt="" title="airfacebook" width="200" height="100" class="alignleft size-full wp-image-2281" /></p>
<p>Hi folks! Today, while mounting some of my <a href="http://blog.yoz.sk/category/projects/">projects</a> into <a href="http://www.adobe.com/uk/products/air/">AIR</a>, I realized that it would be great if I could pusblish <a href="http://www.adobe.com/devnet/air/articles/badge_for_air.html">AIR badges</a> over Facebook. You know what? That is possible! I have created a simple flex application + facebook application that, based on parameters, generates AIR badge for an app. Now its time to share the stuff with you, feel free to publish your AIR badges, and let me know how do you like it.</p>
<p><span id="more-2263"></span></p>
<p>How to use it?</p>
<ol>
<li>Use application inserted below, or open (and bookmark) it in <a href="http://blog.yoz.sk/examples/FacebookAirPublisher/" target="_blank">new window</a>, or use <a href="http://apps.facebook.com/airpublisher/">AIR publisher facebook application</a></li>
<li>click connect (if using facebook application it connects you automatically)</li>
<li>fill desired parameters (click &#8220;fill example&#8221; button to demonstrate working parameters for one of my applications)</li>
<li>click &#8220;publish&#8221; button</li>
<li>wait for Alert with publishing status (displays post id if succeeded)</li>
</ol>
<p>By default it publishes AIR badge directly into <strong>your facebook stream</strong> (wall), plus if you click &#8220;Like&#8221; on my facebook application (facebook restriction), it also publishes the badge into <strong><a href="http://www.facebook.com/apps/application.php?id=102992186427977&#038;v=wall">AIR publisher application wall</a></strong>.</p>
<p><iframe src="http://www.facebook.com/plugins/likebox.php?id=102992186427977&amp;width=292&amp;connections=0&amp;stream=false&amp;header=false&amp;height=62" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100%; height:62px;background:#ffffff"></iframe></p>
<p><iframe src="http://blog.yoz.sk/examples/FacebookAirPublisher" width="100%" height="600" frameborder="0" style="border:none;"></iframe></p>
<p>How would your facebook post look like?</p>
<p><img src="http://blog.yoz.sk/wp-content/uploads/facebookbadge.jpg" alt="" title="facebookbadge" width="511" height="466" class="alignleft size-full wp-image-2278" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yoz.sk/2010/08/publish-your-air-applications-to-facebook/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Neverending Facebook API changes</title>
		<link>http://blog.yoz.sk/2010/07/neverending-facebook-api-change/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=neverending-facebook-api-change</link>
		<comments>http://blog.yoz.sk/2010/07/neverending-facebook-api-change/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 11:35:09 +0000</pubDate>
		<dc:creator>Jozef Chúťka</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[facebook api]]></category>

		<guid isPermaLink="false">http://blog.yoz.sk/?p=1998</guid>
		<description><![CDATA[Believe it or not, facebook changed part of its api again. Since today, authorizing for iframe applications does not work the same way it used to. Previously it was enough to redirect: &#8230; where facebook authorized your app and redirects back to the: &#8230; where session was valid access_token. Since today the mechanism changed into [...]]]></description>
			<content:encoded><![CDATA[<p>Believe it or not, facebook changed part of its api again. Since today, authorizing for iframe applications does not work the same way it used to. Previously it was enough to redirect:</p>
<pre class="brush: plain; title: ; notranslate">https://graph.facebook.com/oauth/authorize
    ?client_id=268718683475
    &amp;redirect_uri=http://apps.facebook.com/blogoauthgraph/
    &amp;scope=publish_stream,user_photos,user_photo_video_tags</pre>
<p>&#8230; where facebook authorized your app and redirects back to the:</p>
<pre class="brush: plain; title: ; notranslate">http://apps.facebook.com/blogoauthgraph/
    ?session=123456...</pre>
<p>&#8230; where session was valid access_token.</p>
<p><span id="more-1998"></span></p>
<p>Since today the mechanism changed into something like this:</p>
<pre class="brush: plain; title: ; notranslate">https://graph.facebook.com/oauth/authorize
    ?client_id=268718683475
    &amp;redirect_uri=http://apps.facebook.com/blogoauthgraph/
    &amp;scope=publish_stream,user_photos,user_photo_video_tags</pre>
<p>&#8230; redirects you to the:</p>
<pre class="brush: plain; title: ; notranslate">http://apps.facebook.com/blogoauthgraph/
    ?code=2.YndguK...</pre>
<p>&#8230; while you do not have valid session (access_token), you have to do the following request:</p>
<pre class="brush: plain; title: ; notranslate">https://graph.facebook.com/oauth/access_token
    ?client_id=268718683475
    &amp;redirect_uri=http://apps.facebook.com/blogoauthgraph/
    &amp;client_secret=YOURSECRET
    &amp;code=2.YndguK...</pre>
<p>&#8230; now facebook responds with:</p>
<pre class="brush: plain; title: ; notranslate">access_token=268718683475|2.Yndgu...&amp;expires=86183</pre>
<p>Notice, this is the response, not the redirect! Now its time to grab the access_token and use it in your app. This change has direct impact on <a href="http://blog.yoz.sk/2010/06/authorizing-iframe-facebook-applications-for-graph-api/">Authorizing Iframe Facebook Applications For Graph API</a> article.</p>
<p>There have also been some other unannounced changes e.g. in facebook app settings in migrations tab &#8220;Remove fb_sig&#8221; toggler&#8230;</p>
<p>Credits goes to my readers Adam Cousins, <a href="http://davidbardos.com/">David Bardos</a>, Garcimore, <a href="http://www.etiennelescot.fr/">Etienne</a> for noticing the changes.</p>
<p>I have just spotted quick fix. All you need to do is add type=user_agent into your auth request:</p>
<pre class="brush: plain; title: ; notranslate">https://graph.facebook.com/oauth/authorize
    ?client_id=268718683475
    &amp;redirect_uri=http://apps.facebook.com/blogoauthgraph/
    &amp;scope=publish_stream,user_photos,user_photo_video_tags
    &amp;type=user_agent</pre>
<p>&#8230; now facebook redirects you to:</p>
<pre class="brush: plain; title: ; notranslate">http://apps.facebook.com/blogoauthgraph/
    ?access_token=123456...
    &amp;expires_in=86729</pre>
<p>This token is valid! I have updated the <a href="http://blog.yoz.sk/2010/06/authorizing-iframe-facebook-applications-for-graph-api/">article</a> with this quickfix.</p>
<p>updated Jul 22, 2010: Facebook rollbacked the change and added &#8220;Canvas Session Parameter&#8221; parameter in facebook app settings / Migrations tab. With this setting enabled, your apps should work normally as they previously did.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yoz.sk/2010/07/neverending-facebook-api-change/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>Extending FacebookOAuthGraph Class</title>
		<link>http://blog.yoz.sk/2010/06/extending-facebookoauthgraph-class/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extending-facebookoauthgraph-class</link>
		<comments>http://blog.yoz.sk/2010/06/extending-facebookoauthgraph-class/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 10:03:06 +0000</pubDate>
		<dc:creator>Jozef Chúťka</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Flash / Flex]]></category>
		<category><![CDATA[callback]]></category>
		<category><![CDATA[Callbacks]]></category>
		<category><![CDATA[facebook api]]></category>
		<category><![CDATA[FacebookOAuthGraph]]></category>

		<guid isPermaLink="false">http://blog.yoz.sk/?p=1854</guid>
		<description><![CDATA[While The Facebook Graph API article becomes pretty popular and a lot of developers keep asking me to publish some practices I use, I managed to create this blog post. Here is a list o some functions you may want to extend FacebookOAuthGraph Class with. Extending &#38; Singletonize First, lets make our class singleton, so [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.yoz.sk/wp-content/uploads/auth-dialog-example.jpg" alt="" title="auth-dialog-example" width="200" height="100" class="alignleft size-full wp-image-1562" /></p>
<p>While <a href="http://blog.yoz.sk/2010/05/facebook-graph-api-and-oauth-2-and-flash/">The Facebook Graph API article</a> becomes pretty popular and a lot of developers keep asking me to publish some practices I use, I managed to create this blog post. Here is a list o some functions you may want to extend <a href="http://blog.yoz.sk/2010/05/facebook-graph-api-and-oauth-2-and-flash/">FacebookOAuthGraph</a> Class with.</p>
<p><span id="more-1854"></span></p>
<h3>Extending &amp; Singletonize</h3>
<p>First, lets make our class <a href="http://blog.yoz.sk/2009/10/actionscript-singleton-pattern/">singleton</a>, so the whole flash project can simply access and use one instance</p>
<pre class="brush: as3; title: ; notranslate">public class Facebook extends FacebookOAuthGraph
{
    private static const _instance:Facebook = new Facebook();
    public function Facebook()
    {
        super();
        useSecuredPath = true;
        if(instance)
            throw new Error(&quot;Use Facebook.instance!&quot;);
    }

    public static function get instance():Facebook
    {
        return _instance;
    }
    ....
}</pre>
<p>Now anywhere in your project:</p>
<pre class="brush: as3; title: ; notranslate">var facebook:Facebook = Facebook.instance;</pre>
<h3>Auto Execution After Authorization:</h3>
<p>Lets say, when user clicks on publish post before your application is connected, just make connect() followed by desired function:</p>
<pre class="brush: as3; title: ; notranslate">if(!facebook.authorized)
    facebook.connect();
facebook.publishPost(...)</pre>
<p>publishPost() automatically executes again after connected thanks to <a href="http://blog.yoz.sk/2010/06/callbacks-class-to-store-your-wishes-in-time/">Callbacks</a> class</p>
<pre class="brush: as3; title: ; notranslate">import sk.yoz.utils.Callbacks;

private function onAuthorized(event:FacebookOAuthGraphEvent):void
{
	Callbacks.execute(&quot;FBstuff&quot;);
}

public function publishPost(...):void
{
    if(!authorized)
        return Callbacks.add(this, arguments.callee, arguments, &quot;FBstuff&quot;);

    // here continues the function code
    ...
}</pre>
<h3>Application Friends</h3>
<p>Lets get list of friends using the application:</p>
<pre class="brush: as3; title: ; notranslate">private function getAppFriends():void
{
	var data:URLVariables = new URLVariables();
	data.query = &quot;SELECT uid, name, pic_square &quot; +
			&quot;FROM user &quot; +
			&quot;WHERE uid IN &quot; +
				&quot;(SELECT uid2 FROM friend WHERE uid1=&quot; + me.id + &quot;) &quot; +
				&quot;AND is_app_user&quot;;

	var loader:URLLoader = call(&quot;method/fql.query&quot;, data,
		URLRequestMethod.POST, null, &quot;https://api.facebook.com&quot;);
	loader.addEventListener(FacebookOAuthGraphEvent.DATA, onGetAppFriends);
}

private function onGetAppFriends(event:FacebookOAuthGraphEvent):void
{
	var xml:XML = new XML(event.rawData);
	var ns:Namespace = xml.namespace();
	default xml namespace = ns;
	xml.namespace(ns.prefix);
	xml.ignoreWhite = true;
	for each(var user:XML in xml.user)
	{
		user.uid.toString();
        user.name.toString();
		...
    }
    default xml namespace = new Namespace(&quot;&quot;);
}</pre>
<h3>Publishing Feeds</h3>
<p>Publish feed with image:</p>
<pre class="brush: as3; title: ; notranslate">public function publishPost(message:String, attachmentName:String,
	attachmentDescription:String):void
{
	var media:Object = {};
	media.src = &quot;http://mydomain.com/feedimage.jpg&quot;;
	media.href = &quot;http://apps.facebook.com/myapp&quot;;
	media.type = &quot;image&quot;;

	var attachment:Object = {};
	attachment.name = attachmentName;
	attachment.href = &quot;http://apps.facebook.com/myapp&quot;;
	attachment.description = attachmentDescription;
	//attachment.caption = &quot;test caption&quot;;
	attachment.media = [media];

	var data:URLVariables = new URLVariables();
	data.message = message;
	data.attachment = JSON.encode(attachment);

	call(&quot;method/stream.publish&quot;, data, URLRequestMethod.POST,
		null, &quot;https://api.facebook.com&quot;);
}</pre>
<p>Publish feed with flash:</p>
<pre class="brush: as3; title: ; notranslate">public function publishFlash(message:String, href:String, swfSrc:String,
	mediaSrc:String, attachmentName:String, attachmentCaption:String,
	attachmentDescription:String, properties:Object=null):void
{
	var media:Object = {};
	media.type = &quot;flash&quot;;
	media.swfsrc = swfSrc;
	media.imgsrc = mediaSrc;
	//media.width = &quot;80&quot;;
	//media.height = &quot;80&quot;;
	media.expanded_width = &quot;460&quot;;
	media.expanded_height = &quot;460&quot;;

	var attachment:Object = {};
	attachment.name = attachmentName;
	attachment.href = href;
	attachment.caption = attachmentCaption;
	attachment.description = attachmentDescription;
	attachment.media = [media];
	attachment.properties = properties; // action links
	// properties {prop1:{text: &quot;value 1&quot;, href:&quot;http://&quot;}, prop2:...};

	var data:URLVariables = new URLVariables();
	data.message = message;
	data.attachment = JSON.encode(attachment);

	call(&quot;method/stream.publish&quot;, data, URLRequestMethod.POST, null,
		&quot;https://api.facebook.com&quot;);
}</pre>
<p>Publish feed with action links:</p>
<pre class="brush: as3; title: ; notranslate">var properties:Object = {};
properties.MOVE = {
	text: &quot;mouse drag&quot;,
	href:config.urlManager.boardURL};
properties.ZOOM = {
	text: &quot;double click, [Page Up], [Page Down]&quot;,
	href:config.urlManager.boardURL};
properties.ROTATE = {
	text: &quot;[Ctrl] + mouse move&quot;,
	href:config.urlManager.boardURL};

attachment.properties = properties;</pre>
<p>Publishing feed using Graph API (<a href="http://developers.facebook.com/docs/api#publishing">docs</a>, from <a href="http://bugs.developers.facebook.net/show_bug.cgi?id=10672">facebook bugzilla</a>):</p>
<ul>
<li>forget everything related to the old &#8220;media&#8221; stuff of the attachment</li>
<li>put what you had in <del datetime="2010-09-09T14:01:25+00:00">swfsrc</del> into <strong>source</strong> (mandatory)</li>
<li>put what you had in <del datetime="2010-09-09T14:01:25+00:00">imgsrc</del> into <strong>picture</strong> (mandatory)</li>
<li><strong>link</strong> is mandatory also and must points to the connect or canvas URL</li>
<li>Feed arguments: message, picture, link, name, caption, description, source</li>
</ul>
<h3>Uploading Photo</h3>
<p>This is a piece of working code from <a href="http://www.seanhak.net/">Sean</a>, more <a href="http://blog.yoz.sk/examples/FacebookOAuthGraph/as/uploadImage.as">upload handling functions and album creating</a> can be found here. thnx Sean:</p>
<pre class="brush: as3; title: ; notranslate">// MultipartURLLoader by Eugene Zatepyakin can be found here: http://bit.ly/9wx4q7
public function uploadImageCall(bytes:ByteArray, message:String):MultipartURLLoader
{
    var mpLoader:MultipartURLLoader = new MultipartURLLoader();
    mpLoader.addVariable(&quot;message&quot;, message);
    mpLoader.addFile(bytes, &quot;image.jpg&quot;, &quot;image&quot;);
    loaderAddListeners(mpLoader.loader);
    mpLoader.load(apiSecuredPath + &quot;/me/photos?access_token=&quot;+ token);
    return mpLoader;
}</pre>
<h3>Palming Token</h3>
<p>When localy debuging your app you may want to palm off custom access_token:</p>
<pre class="brush: as3; title: ; notranslate">if(parameters.debug)
    facebook.hackToken(parameters, &quot;110363ABXY...&quot;); // copypaste from callback.html hash
facebook.autoConnect(parameters);</pre>
<p>in Facebook.as:</p>
<pre class="brush: as3; title: ; notranslate">public function hackToken(parameters:Object, token:String):Object
{
	if(!parameters.session)
		parameters.session = JSON.encode({
			access_token:String(token).replace(/\%7C/g, &quot;|&quot;)});
	return parameters;
}</pre>
<h3>Advanced Crossdomain Working Authorization</h3>
<p>Or if you prefer or need advanced callback, that works crossdomain, and also for local debuging: callback.html</p>
<pre class="brush: xml; title: ; notranslate">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;sk&quot; lang=&quot;sk&quot; dir=&quot;ltr&quot;&gt;
&lt;head&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;js/swfobject.js&quot;&gt;&lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot;&gt;
	&lt;!--
		if(window.opener &amp;&amp; window.opener.confirmFacebookConnection){
			window.opener.confirmFacebookConnection(window.location.hash);
			self.close();
		}else{
			var flashvars = {};
			flashvars.connectionName = &quot;_facebookConnector&quot;;
			flashvars.methodName = &quot;confirmConnection&quot;;
			flashvars.hash = window.location.hash;

			swfobject.embedSWF(&quot;flash/Callback.swf&quot;, &quot;flash&quot;, &quot;1&quot;, &quot;1&quot;, &quot;10.0.0&quot;,
				&quot;expressInstall.swf&quot;, flashvars, {}, {});
		}
	//--&gt;
	&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;p&gt;You may now close this window.&lt;/p&gt;
	&lt;div id=&quot;flash&quot;&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>universal <a href="http://blog.yoz.sk/examples/FacebookOAuthGraph/Callback.swf">callback.swf</a> (741 Bytes) main class:</p>
<pre class="brush: as3; title: ; notranslate">package
{
    import flash.display.Sprite;
    import flash.net.LocalConnection;

    public class Callback extends Sprite
    {
        public function Callback()
        {
            super();
            var parameters:Object = loaderInfo.parameters
            var localConnection:LocalConnection = new LocalConnection();
            localConnection.send(
                parameters.connectionName,
                parameters.methodName,
                parameters.hash);
        }
    }
}</pre>
<p>facebook.as class:</p>
<pre class="brush: as3; title: ; notranslate">private var localConnection:LocalConnection;

override public function connect():void
{
	super.connect();

	if(!localConnection)
	{
		localConnection = new LocalConnection();
		localConnection.client = this;
		localConnection.allowDomain(&quot;*&quot;);
		localConnection.allowInsecureDomain(&quot;*&quot;);
		localConnection.connect(&quot;_facebookConnector&quot;);
	}
}

private function onAuthorized(event:FacebookOAuthGraphEvent):void
{
	// listener defined in Facebook constructor:
	// addEventListener(FacebookOAuthGraphEvent.AUTHORIZED, onAuthorized);

	try
	{
		localConnection.close();
		localConnection = null;
	}
	catch(error:Error){}
}</pre>
<h3>Getting All The Photos Of All Albums Of 1 User</h3>
<p>Credits to <a href="http://www.etiennelescot.fr/">Etienne</a>, thnx</p>
<pre class="brush: as3; title: ; notranslate">function getAllphotos(uid:String):void {
	var data:URLVariables = new URLVariables();
	data.query = &quot;SELECT src_small, src_big &quot; +
		&quot;FROM photo &quot; +
		&quot;WHERE aid IN ( SELECT aid FROM album WHERE owner='&quot;+HERE PUT THE USER ID+&quot;' )&quot;
	var loader:URLLoader = facebook.call(&quot;method/fql.query&quot;, data,URLRequestMethod.POST,
		null, &quot;https://api.facebook.com&quot;);
	loader.addEventListener(FacebookOAuthGraphEvent.DATA, onGetAllphotos);
}</pre>
<h3>Tagging photos</h3>
<p>This script uses <a href="http://developers.facebook.com/docs/reference/rest/photos.addTag">photos.addTag</a> &#8211; part of old REST api (some <a href="http://blog.yoz.sk/2010/06/extending-facebookoauthgraph-class/#comment-3504">more reading</a>):</p>
<pre class="brush: as3; title: ; notranslate">var data:URLVariables = new URLVariables();
data.pid = photoID;
data.tag_uid = userID; // user on photo we are tagging
data.x = 50; // 50% means center
data.y = 50; // 50% means middle
call(&quot;method/photos.addTag&quot;, data, URLRequestMethod.GET, null, &quot;https://api.facebook.com&quot;);</pre>
<p>Important: Graph API upload call returns the object_id. In order to get pid you have to lookup in photo table:</p>
<pre class="brush: sql; title: ; notranslate">SELECT pid FROM photo WHERE object_id=response.id</pre>
<h3>Catching verify token error</h3>
<p>In order to catch the ERROR event with verifyToken() method <a href="http://dndigital.net/">Nils</a> <a href="http://blog.yoz.sk/2010/06/authorizing-iframe-facebook-applications-for-graph-api/#comment-3042">suggested</a> the following:</p>
<pre class="brush: as3; title: ; notranslate">override public function verifyToken(token:String):URLLoader
{
    var loader:URLLoader = super.verifyToken(token);
    loader.addEventListener(FacebookOAuthGraphEvent.ERROR,
        function(event:FacebookOAuthGraphEvent):void
        {
            _authorized = false;
            _me = null;
            _token = null;
            EventDispatcher(event.currentTarget)
                .removeEventListener(event.type, arguments.callee);
            var type:String = FacebookOAuthGraphEvent.UNAUTHORIZED;
            dispatchEvent(new FacebookOAuthGraphEvent(type));
        });
    return loader;
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.yoz.sk/2010/06/extending-facebookoauthgraph-class/feed/</wfw:commentRss>
		<slash:comments>129</slash:comments>
		</item>
		<item>
		<title>Authorizing Iframe Facebook Applications For Graph API</title>
		<link>http://blog.yoz.sk/2010/06/authorizing-iframe-facebook-applications-for-graph-api/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=authorizing-iframe-facebook-applications-for-graph-api</link>
		<comments>http://blog.yoz.sk/2010/06/authorizing-iframe-facebook-applications-for-graph-api/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 11:48:09 +0000</pubDate>
		<dc:creator>Jozef Chúťka</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Flash / Flex]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Access Token]]></category>
		<category><![CDATA[facebook api]]></category>
		<category><![CDATA[FacebookOAuthGraph]]></category>
		<category><![CDATA[Graph API]]></category>
		<category><![CDATA[OAuth]]></category>
		<category><![CDATA[session]]></category>

		<guid isPermaLink="false">http://blog.yoz.sk/?p=1732</guid>
		<description><![CDATA[This article continues my exploration of best facebook graph api integration into your flash app. Before continue reading, make sure you understand the previous article. Due to huge interest, I am adding codes that makes your flash app working with graph api within facebook iframe. Try this app live on http://apps.facebook.com/blogoauthgraph/, notice once you get [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.yoz.sk/wp-content/uploads/auth-dialog-example.jpg" alt="" title="auth-dialog-example" width="200" height="100" class="alignleft size-full wp-image-1562" /></p>
<p>This article continues my exploration of best facebook graph api integration into your flash app. Before continue reading, make sure you understand the <a href="http://blog.yoz.sk/2010/05/facebook-graph-api-and-oauth-2-and-flash/">previous article</a>. Due to huge interest, I am adding codes that makes your flash app working with graph api within facebook iframe. Try this app live on <a href="http://apps.facebook.com/blogoauthgraph/">http://apps.facebook.com/blogoauthgraph/</a>, notice once you get there, you are redirected to grant permissions (if not authorized or granted already) and then redirected back to the app, where you are connected and ready to use graph api.</p>
<p><span id="more-1732"></span></p>
<p>What I did was changing one line of ActionScript, I added autoConnect() methods that sends app flashvars directly into <a href="http://classes.yoz.sk/sk/yoz/net/FacebookOAuthGraph.as">FacebookOAuthGraph</a> object.</p>
<pre class="brush: as3; title: ; notranslate">var facebook:FacebookOAuthGraph = new FacebookOAuthGraph();
...
facebook.autoConnect(parameters); // passing flashvars</pre>
<p>See <a href="http://blog.yoz.sk/2010/05/facebook-graph-api-and-oauth-2-and-flash/">full ActionScript code</a> for details.</p>
<p>Now there is a different html wrapper for facebook iframe &#8211; facebook.php:</p>
<pre class="brush: php; title: ; notranslate">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; lang=&quot;cs&quot; xml:lang=&quot;cs&quot;&gt;
&lt;head&gt;
    &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
    &lt;meta http-equiv=&quot;Content-language&quot; content=&quot;cs&quot; /&gt;
    &lt;title&gt;FacebookOAuthGraphTest&lt;/title&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;js/swfobject.js&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot;&gt;
        //&lt;![CDATA[
		function allRequestParameters()
		{
			var data = {};
			var strHref = window.location.href;
			if ( strHref.indexOf(&quot;?&quot;) &gt; -1 ) {
				var strQueryString = strHref.substr(strHref.indexOf(&quot;?&quot;)+1);
				var aQueryString = strQueryString.split(&quot;&amp;&quot;);
				for ( var iParam = 0; iParam &lt; aQueryString.length; iParam++ ) {
					var aParam = aQueryString[iParam].split(&quot;=&quot;);
					data[aParam[0]] = aParam[1];
				}
			}
			return data;
		}

		function generateFlash()
		{
			var flashvars = allRequestParameters();
			flashvars.session = '{&quot;access_token&quot;:&quot;' + signed_request.oauth_token + '&quot;}';

			var params = {
				allowScriptAccess: &quot;sameDomain&quot;
			};

			var attributes = {
				id: &quot;FacebookOAuthGraphTest&quot;,
				name: &quot;FacebookOAuthGraphTest&quot;
			};

			swfobject.embedSWF(&quot;FacebookOAuthGraphTest.swf?v=2&quot;, &quot;alternative&quot;, &quot;100%&quot;, &quot;100%&quot;, &quot;10.0.0&quot;,
				&quot;expressInstall.swf&quot;, flashvars, params, attributes);
		}

		&lt;?php
		$signed_request = $_REQUEST[&quot;signed_request&quot;];
		list($encoded_sig, $payload) = explode('.', $signed_request, 2);
		$data = base64_decode(strtr($payload, '-_', '+/'));
		echo &quot;var signed_request=&quot; . $data . &quot;;&quot;;
		?&gt;

		if(!signed_request.oauth_token){
			window.top.location = &quot;https://www.facebook.com/dialog/oauth&quot;
				+ &quot;?client_id=&quot; + '268718683475'
				+ &quot;&amp;redirect_uri=&quot; + 'http://apps.facebook.com/blogoauthgraph/'
				+ &quot;&amp;scope=publish_stream,user_photos,user_photo_video_tags&quot;
				+ &quot;&amp;response_type=token&quot;;
		}else{
			generateFlash();
		}
        //]]&gt;
    &lt;/script&gt;
    &lt;style&gt;
        body {margin:0px;overflow:hidden}
        html, body, object, embed {width:100%;height:100%;outline:none;}
    &lt;/style&gt;
 &lt;/head&gt;
 &lt;body style=&quot;text-align:center;&quot;&gt;
    &lt;div id=&quot;alternative&quot;&gt;
        &lt;a href=&quot;http://www.adobe.com/go/getflashplayer&quot;&gt;
            &lt;img src=&quot;http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif&quot; alt=&quot;Get Adobe Flash player&quot; /&gt;
        &lt;/a&gt;
    &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>There are few lines of code to be mentioned:</p>
<ul>
<li><del datetime="2011-03-16T08:55:15+00:00">getRequestParameter(name) &#8211; returns GET parameter from iframe url, you can use your own functions</del></li>
<li>allRequestParameters() &#8211; returns object consisting of all iframe GET parameters, used to pass flashvars into our flash</li>
<li>php code to define javascript signed_request variable containing valid token</li>
<li>window.top.location &#8211; if there is no token parameter found (not authorized yet), you are redirected to the facebook authorization. Do not forget to change <strong>client_id</strong> and <strong>redirect_uri</strong> when using for your app.</li>
</ul>
<p>Facebook settings:</p>
<pre class="brush: plain; title: ; notranslate">App ID: 268718683475
Site URL: http://blog.yoz.sk/examples/FacebookOAuthGraph/
Site Domain: yoz.sk
Canvas Page: http://apps.facebook.com/blogoauthgraph/
Canvas URL: http://blog.yoz.sk/examples/FacebookOAuthGraph/facebook.php?a=b
Canvas FBML/iframe: iframe

Disable Deprecated Auth Methods: Enabled
Stream post URL security: Disabled
OAuth 2.0 for Canvas: Enabled
POST for Canvas: Enabled
Canvas Session Parameter (Deprecated): Disabled
November 2010 Rollup: Enabled
Timezone-less events: Enabled
Upgrade to Requests 2.0: Enabled
JSON Encoding Empty Arrays: Enabled</pre>
<p>Here is the final facebook app <a href="http://apps.facebook.com/blogoauthgraph/">http://apps.facebook.com/blogoauthgraph/</a></p>
<p><del datetime="2011-03-16T08:55:15+00:00">updated Jul 21, 2010: Quickfix for late facebook changes:</del></p>
<p><del datetime="2011-03-16T09:07:55+00:00">updated Jul 22, 2010: Facebook rollbacked the change and added &#8220;Canvas Session Parameter&#8221; parameter in facebook app settings / Migrations tab. With this setting enabled, your apps should work normally as they previously did.</del></p>
<p>updated Mar 16, 2011: Catching token from POST parameter.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yoz.sk/2010/06/authorizing-iframe-facebook-applications-for-graph-api/feed/</wfw:commentRss>
		<slash:comments>115</slash:comments>
		</item>
		<item>
		<title>Facebook Graph API &amp; OAuth 2.0 &amp; Flash (update)</title>
		<link>http://blog.yoz.sk/2010/05/facebook-graph-api-and-oauth-2-and-flash/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=facebook-graph-api-and-oauth-2-and-flash</link>
		<comments>http://blog.yoz.sk/2010/05/facebook-graph-api-and-oauth-2-and-flash/#comments</comments>
		<pubDate>Wed, 05 May 2010 15:04:22 +0000</pubDate>
		<dc:creator>Jozef Chúťka</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Flash / Flex]]></category>
		<category><![CDATA[Access Token]]></category>
		<category><![CDATA[facebook api]]></category>
		<category><![CDATA[FacebookOAuthGraph]]></category>
		<category><![CDATA[Graph API]]></category>
		<category><![CDATA[OAuth]]></category>

		<guid isPermaLink="false">http://blog.yoz.sk/?p=1560</guid>
		<description><![CDATA[As previously mentioned, facebook released a new Graph API. It is based on OAuth 2.0 protocol (old authorization token also works). While it is fresh thing, there is no much ActionScript stuff around, so I came with FacebookOAuthGraph class. This class is meant to be used as an abstract class, while it contains just the [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.yoz.sk/wp-content/uploads/auth-dialog-example.jpg" alt="" title="auth-dialog-example" width="200" height="100" class="alignleft size-full wp-image-1562" /></p>
<p>As previously mentioned, <a href="http://blog.yoz.sk/2010/04/facebook-now-with-oauth-and-open-graph/">facebook released a new Graph API</a>. It is based on OAuth 2.0 protocol (old authorization token also works). While it is fresh thing, there is no much ActionScript stuff around, so I came with <a href="http://classes.yoz.sk/sk/yoz/net/FacebookOAuthGraph.as">FacebookOAuthGraph</a> class. This class is meant to be used as an abstract class, while it contains just the basic authentication algorithm and call method to request data. It stores access token in SharedObject, so next time you came into app, you get connected on background without noticing (no popup etc.). Your token should expire in 24 hours.</p>
<p><span id="more-1560"></span></p>
<p>Here is the code for the following flex app, to make it work, get latest <a href="http://classes.yoz.sk/sk/yoz/net/FacebookOAuthGraph.as">FacebookOAuthGraph</a> and <a href="http://classes.yoz.sk/sk/yoz/events/FacebookOAuthGraphEvent.as">FacebookOAuthGraphEvent</a> classes.</p>
<pre class="brush: xml; title: ; notranslate">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot;
    applicationComplete=&quot;init()&quot;&gt;
&lt;mx:Script&gt;
&lt;![CDATA[

    import sk.yoz.events.FacebookOAuthGraphEvent;
    import sk.yoz.net.FacebookOAuthGraph;

    // facebook Application ID
    private var clientId:String = &quot;268718683475&quot;;

    // path to our callback
    private var redirectURI:String =
        &quot;http://blog.yoz.sk/examples/FacebookOAuthGraph/callback.html&quot;;

    // required extended permissions
    private var scope:String = &quot;publish_stream,user_photos,user_photo_video_tags&quot;;

    private var facebook:FacebookOAuthGraph = new FacebookOAuthGraph();

    [Bindable] private var connected:Boolean;

    private function init():void
    {
        facebook.clientId = clientId;
        facebook.redirectURI = redirectURI;
        facebook.scope = scope;
        facebook.useSecuredPath = true;
        facebook.addEventListener(FacebookOAuthGraphEvent.AUTHORIZED, authorized);

        // stage.root.loaderInfo.parameters
        facebook.autoConnect(parameters);

        log.text += &quot;checkSavedToken()\n&quot;;
    }

    private function connect():void
    {
        facebook.connect();

        log.text += &quot;connect()\n&quot;;
    }

    private function authorized(event:FacebookOAuthGraphEvent):void
    {
        connected = true;

        log.text += &quot;authorized\n&quot;;
    }

    private function call(path:String, binary:Boolean):void
    {
        var loader:URLLoader = facebook.call(path);
        loader.dataFormat = binary
            ? URLLoaderDataFormat.BINARY
            : URLLoaderDataFormat.TEXT;
        loader.addEventListener(FacebookOAuthGraphEvent.DATA, callComplete);
        log.text += &quot;call(&quot; + path + &quot;)\n&quot;;
    }

    private function changeStatus(message:String):void
    {
        var data:URLVariables = new URLVariables();
        data.message = message;
        var method:String = URLRequestMethod.POST;
        var loader:URLLoader = facebook.call(&quot;me/feed&quot;, data, method);
        loader.addEventListener(FacebookOAuthGraphEvent.DATA, callComplete);
        log.text += &quot;changeStatus(&quot; + message + &quot;)\n&quot;;
    }

    private function callComplete(event:FacebookOAuthGraphEvent):void
    {
        log.text += &quot;call completed -&gt; see result\n&quot;;

        if(event.rawData is ByteArray)
        {
            var loader:Loader = new Loader();
            loader.loadBytes(event.rawData as ByteArray);
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
                function():void
                {
                    image.source = loader;
                });
        }
        else
        {
            result.text = event.rawData.toString();
        }
    }
]]&gt;
&lt;/mx:Script&gt;
&lt;mx:HBox&gt;
    &lt;mx:Button click=&quot;connect()&quot; label=&quot;connect&quot; /&gt;
    &lt;mx:Text text=&quot;{connected ? 'connected' : 'not connected'}&quot; /&gt;
&lt;/mx:HBox&gt;
&lt;mx:HBox visible=&quot;{!connected}&quot; includeInLayout=&quot;{!connected}&quot;&gt;
    &lt;mx:Text text=&quot;#access_token=121161974560905%7C2...&quot; /&gt;
    &lt;mx:TextInput id=&quot;hash&quot; /&gt;
    &lt;mx:Button label=&quot;add hash&quot; click=&quot;facebook.confirmConnection(hash.text)&quot;/&gt;
&lt;/mx:HBox&gt;
&lt;mx:HBox&gt;
    &lt;mx:TextInput id=&quot;path&quot; text=&quot;me&quot; /&gt;
    &lt;mx:Button label=&quot;call&quot; click=&quot;call(path.text, false)&quot; enabled=&quot;{connected}&quot;/&gt;
    &lt;mx:Spacer width=&quot;20&quot; /&gt;
    &lt;mx:TextInput id=&quot;path2&quot; text=&quot;me/picture&quot; /&gt;
    &lt;mx:Button label=&quot;call binary&quot; click=&quot;call(path2.text, true)&quot; enabled=&quot;{connected}&quot;/&gt;
&lt;/mx:HBox&gt;
&lt;mx:HBox&gt;
    &lt;mx:TextInput id=&quot;status&quot; text=&quot;testing FacebookOAuthGraph&quot; /&gt;
    &lt;mx:Button label=&quot;change status&quot; click=&quot;changeStatus(status.text)&quot; enabled=&quot;{connected}&quot;/&gt;
&lt;/mx:HBox&gt;
&lt;mx:HDividedBox width=&quot;100%&quot; height=&quot;100%&quot;&gt;
    &lt;mx:TextArea width=&quot;30%&quot; height=&quot;100%&quot; id=&quot;log&quot;/&gt;
    &lt;mx:TextArea width=&quot;70%&quot; height=&quot;100%&quot; id=&quot;result&quot;/&gt;
    &lt;mx:Image id=&quot;image&quot; /&gt;
&lt;/mx:HDividedBox&gt;
&lt;/mx:Application&gt;</pre>
<p>Make sure your html wrapper defines correct allowScriptAccess and both id and name for &lt;object&gt; tag. This enables ExternalInterface.objectID. With swfobject use:</p>
<pre class="brush: jscript; title: ; notranslate">var params = {
    allowScriptAccess: &quot;sameDomain&quot;
};

var attributes = {
    id: &quot;FacebookOAuthGraphTest&quot;,
    name: &quot;FacebookOAuthGraphTest&quot;
};
swfobject.embedSWF(&quot;FacebookOAuthGraphTest.swf&quot;, &quot;alternative&quot;, &quot;100%&quot;, &quot;100%&quot;, &quot;10.0.0&quot;,
    &quot;expressInstall.swf&quot;, flashvars, params, attributes);</pre>
<p>callback.html pushes url hash into flash app. When running this application from desktop (creating/debugging), your callback.html located on public domain has no access to its opener (different domain &#8211; XSS), so you need to pass access_token manualy into &lt;TextInput id=&#8221;hash&#8221;&gt;, but once your flash application is on the same domain with callback, it works automaticaly.</p>
<p>callback.html:</p>
<pre class="brush: xml; title: ; notranslate">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;sk&quot; lang=&quot;sk&quot; dir=&quot;ltr&quot;&gt;
&lt;head&gt;
	&lt;script type=&quot;text/javascript&quot;&gt;
	&lt;!--
		if(window.opener &amp;&amp; window.opener.confirmFacebookConnection)
		{
			window.opener.confirmFacebookConnection(window.location.hash);
			self.close();
		}
	//--&gt;
	&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;You may now close this window.&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>Click connect and allow facebook application. Facebook redirects to callback.html that pastes hash into flash and closes popup. Now you are authenticated. Next time you visit this flash application (refresh this page) you will get authenticated in background (if your access token is still valid). Notice, some graph api calls returns JSON objects (me), other may return binary data (me/picture). For now it may take some time to finish calls (5 second or more), but I hope facebook will soon make it fast.</p>
<p><iframe src="http://blog.yoz.sk/examples/FacebookOAuthGraph/" width="100%" height="500" style="border:none;"></iframe></p>
<p>You get your JSON decoded data via event.data. Just make sure you do not try to decode ByteArray (eg. me/picture)</p>
<pre class="brush: as3; title: ; notranslate">// call(&quot;me&quot;)
private function callComplete(event:FacebookOAuthGraphEvent):void
{
    trace(event.data.name);
}</pre>
<p>Some calls to test:</p>
<pre class="brush: plain; title: ; notranslate">Friends:             me/friends
News feed:           me/home
Profile feed (Wall): me/feed
Likes:               me/likes
Movies:              me/movies
Books:               me/books
Notes:               me/notes
Photos:              me/photos
Videos:              me/videos
Events:              me/events
Groups:              me/groups</pre>
<p>Additional information about my facebook app (see <a href="http://blog.yoz.sk/examples/FacebookOAuthGraph/settings.png">all settings</a>):</p>
<pre class="brush: plain; title: ; notranslate">Application ID:         268718683475
App Domain:              yoz.sk
Website / Site URL:      http://blog.yoz.sk/examples/FacebookOAuthGraph/
App on FB / Canvas URL:  http://blog.yoz.sk/examples/FacebookOAuthGraph/facebook.php?a=b
Page Tab / Page Tab URL: http://blog.yoz.sk/examples/FacebookOAuthGraph/facebook.html?
Canvas type:             iframe
Developer Mode:          Off
App Type:                Native/Desktop
Sandbox Mode:            Disabled
Remove Deprecated APIs:  Enabled
signed_request for Canvas: Enabled
Timezone-less events:    Enabled
Encrypted Access Token:  Enabled
...other Migrations:     Disabled</pre>
<p>Based on facebook access token, it should be valid approximately for 24 hours. Notice the bold part, works as expiration time (unix time format). Use FacebookOAuthGraph.tokenToExpiration() to parse Date:</p>
<p>access_token=268718683475%7C2.w3fjqz80Xi1CdBXt7Ygh6A__.86400.<strong><em>1273158000</em></strong>-1215645368%7CDGv2l2HtTymd6cM6Fy_8k6P_8CQ.</p>
<p><strong>Important update:</strong> May 19, 2010: Application is working again. Due to <a href="http://bugs.developers.facebook.com/show_bug.cgi?id=10055">massive support in bug tracker</a> (thanks all for your votes), facebook devs changed secured <a href="https://graph.facebook.com/crossdomain.xml">crossdomain.xml</a>, so it allows unsecured requests. changeStatus() method added into example and some minor changes in FacebookOAuthGraph class (please update).</p>
<p>Here is what happend and why this app was not working for a while:</p>
<ul>
<li>May 11, 2010: facebook changed rules, so requests on unsecured graph service (via http://graph.facebook.com&#8230;) were limited to just those without access_token parameter. Requets to secured service (https://graph.facebook.com) resulted in security violation due to missing secure=&#8221;false&#8221; parameter in <a href="https://graph.facebook.com/crossdomain.xml">crossdomain.xml</a></li>
<li>May 12, 2010: <a href="http://bugs.developers.facebook.com/show_bug.cgi?id=10055">bug submitted</a></li>
<li>May 12, 2010 &#8211; May 14, 2010: massive bug voting</li>
<li>May 14, 2010: Bug confirmed by facebook dev team</li>
<li>May 19, 2010: Bug fixed, crossdomain file changed</li>
</ul>
<p>I am glad that facebook devs listens and care. <img src='http://blog.yoz.sk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h2>FAQ</h2>
<h3>Is there a .fla version available?</h3>
<p>Yes, there is a simple working Flash CS4 <a href="http://blog.yoz.sk/examples/FacebookOAuthGraph/src/cs4.zip">archive available for download (.fla + all sources)</a>. The demo connects the facebook application and once connected, it uploads generated picture into photo album.</p>
<h3>How can I use this class in my iframe canvas page?</h3>
<p>Please read article <a href="http://blog.yoz.sk/2010/06/authorizing-iframe-facebook-applications-for-graph-api/">Authorizing Iframe Facebook Applications For Graph API</a></p>
<h3>How can I make this class do more advanced things and what are the best practices?</h3>
<p>Please read article <a href="http://blog.yoz.sk/2010/06/extending-facebookoauthgraph-class/">Extending FacebookOAuthGraph Class</a>, where all the most comon extendings are described.</p>
<h3>When I connect with this app in one browser (firefox), and I run another browser (chrome) I get automatically connected. Why?</h3>
<p>Your authorization token is stored in SharedObject, that is OS-user persistent (eg. windows user). No matter what browser you run, all of those reads data from one SharedObject. If you need cookie or session persistent authorization, please extend my class and override methods that use SharedObject.</p>
<h3>How to add request parameters into my call?</h3>
<p>Pass URLVariables object as a second parameter to call() method:</p>
<pre class="brush: as3; title: ; notranslate">// eg. in order to make this call &quot;me/picture?type=large&quot;, do the following:
var data:URLVariables = new URLVariables();
data.type = &quot;large&quot;
call(&quot;me/picture&quot;, data);</pre>
<h3>Why I can not access me/photos?</h3>
<p>Facebook has changed rules again. You also need &#8220;user_photo_video_tags&#8221; permission within your app. I have already added it into my app, so please remove your browser cache, refresh and click connect button again (even if you are connected already). Now it should work.</p>
<h3>How to upload photo with graph api?</h3>
<p>This is a piece of working code from <a href="http://www.seanhak.net/">Sean</a>, thnx Sean:</p>
<pre class="brush: as3; title: ; notranslate">// MultipartURLLoader by Eugene Zatepyakin can be found here: http://bit.ly/9wx4q7
public function uploadImageCall(path:String, ba:ByteArray, message:String, token:String=null):MultipartURLLoader
{
    var mpLoader:MultipartURLLoader = new MultipartURLLoader();
    mpLoader.addVariable(&quot;message&quot;, message);
    mpLoader.addFile(ba, &quot;image.jpg&quot;, &quot;image&quot;);
    loaderAddListeners(mpLoader.loader);
    mpLoader.load(apiSecuredPath + &quot;/me/photos?access_token=&quot;+ token);
    return mpLoader;
}</pre>
<h3>Can I make fql calls with this class?</h3>
<p>However graph api does not implement fql calls, you can make fql calls using this class. The resulted data are not JSON but XML:</p>
<pre class="brush: as3; title: ; notranslate">var data:URLVariables = new URLVariables();
data.query = &quot;SELECT uid, name FROM user WHERE uid = XXX&quot;; // insert your uid
var loader:URLLoader = facebook.call(&quot;method/fql.query&quot;, data,
    URLRequestMethod.POST, null, &quot;https://api.facebook.com&quot;);
loader.addEventListener(FacebookOAuthGraphEvent.DATA, fqlComplete);

private function fqlComplete(event:FacebookOAuthGraphEvent):void{
        var xml:XML = new XML(event.rawData);</pre>
<p>For fqlComplete method, please read <a href="http://blog.yoz.sk/2010/01/parsing-fql-result/">Parsing FQL result</a> article.</p>
<h3>Can I post feeds with attachments?</h3>
<p>Graph API has not documented attachment functionality for feeds, anyway, you can publish streams with attachments with this class as simple as:</p>
<pre class="brush: as3; title: ; notranslate">var media:Object = {};
media.type = &quot;flash&quot;;
media.swfsrc = &quot;http://zombo.com/inrozxa.swf&quot;;
media.imgsrc = &quot;http://blog.yoz.sk/wp-content/uploads/3d-150x150.jpg&quot;;
media.width = &quot;80&quot;;
media.height = &quot;80&quot;;
media.expanded_width = &quot;120&quot;;
media.expanded_height = &quot;120&quot;;

var attachment:Object = {};
attachment.name = &quot;test name&quot;;
attachment.href = &quot;http://blog.yoz.sk&quot;
attachment.description = &quot;test description&quot;;
attachment.caption = &quot;test caption&quot;;
attachment.media = [media];

var data:URLVariables = new URLVariables();
data.message = &quot;test message&quot;;
data.attachment = JSON.encode(attachment);

facebook.call(&quot;method/stream.publish&quot;, data, URLRequestMethod.POST, null, &quot;https://api.facebook.com&quot;);</pre>
<h3>How can I develop my app locally when callback only works on the domain?</h3>
<p>While callback is not able to push access_token into your app on runtime, I just copy access_token value into my code and publish again:</p>
<pre class="brush: as3; title: ; notranslate">if(!parameters.session)
parameters.session = JSON.encode({
    access_token:String(&quot;123864964303507%7C2._pSS7WlemeGB9M0RV8Vnuw__.3600.1276246800-1215645368%7C-kYjWPx4MR6DXc5Clcnv5kXX3t4.&quot;)
        .replace(/\%7C/g, &quot;|&quot;)
});
facebook.autoConnect(parameters);</pre>
<h3>Hi Is there a way to implement a “i Like” button with your class?</h3>
<p>Sorry, you can not use graph API to like stuff, there is no method for that. Even by testing like request:</p>
<pre class="brush: plain; title: ; notranslate">href: http://www.facebook.com/pages/***
node_type: page
edge_type: like
page_id: 12345
action_text
now_connected: true
nctr[_mod]: connect
post_form_id: 123ABF***********
fb_dtsg: TAfAJ
post_form_id_source: AsyncRequest</pre>
<p>&#8230; post_form_id is some static required parameter that you can not guess.</p>
<h3>This example app works with Internet Explorer, but my one results in Error #2032</h3>
<p><del datetime="2010-08-04T08:05:14+00:00">Please complie your app to Flash Player 10 (or later). It should fix this issue. Credits goes to Garcimore <img src='http://blog.yoz.sk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> , thnx</del>. The issue has been identified as <a href="http://bugs.developers.facebook.com/show_bug.cgi?id=10631">header Content-Type: application/json</a>, that is returned from facebook. Suggested workaround (by facebook dev team) is to use POST variables with your requests, however <a href="#comment-2737">it is reported as not working solution</a>. </p>
<h3>I can not make it run in my Mac-Safari sonfiguration</h3>
<p>It seems there is a bug in Safari on Mac that does not let you open popup via ExternalInterface. You should use navigateToURL() in that case. Credits goes to Beans, thank you. <a href="http://blog.yoz.sk/2010/05/facebook-graph-api-and-oauth-2-and-flash/#comment-3125">More instructions here</a>.</p>
<pre class="brush: as3; title: ; notranslate">var js:String = &quot;return window.navigator.userAgent.indexOf('Safari') &gt; -1);&quot;
if(ExternalInterface.call(&quot;function(){&quot; + js + &quot;}&quot;)){
   // safari specific code</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.yoz.sk/2010/05/facebook-graph-api-and-oauth-2-and-flash/feed/</wfw:commentRss>
		<slash:comments>433</slash:comments>
		</item>
		<item>
		<title>Facebook now with OAuth and Open Graph (update)</title>
		<link>http://blog.yoz.sk/2010/04/facebook-now-with-oauth-and-open-graph/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=facebook-now-with-oauth-and-open-graph</link>
		<comments>http://blog.yoz.sk/2010/04/facebook-now-with-oauth-and-open-graph/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 09:11:20 +0000</pubDate>
		<dc:creator>Jozef Chúťka</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Technologies]]></category>
		<category><![CDATA[F8]]></category>
		<category><![CDATA[facebook api]]></category>
		<category><![CDATA[OAuth]]></category>
		<category><![CDATA[Open Graph]]></category>

		<guid isPermaLink="false">http://blog.yoz.sk/?p=1462</guid>
		<description><![CDATA[Few days before while I was working on TwitterLogger Class for ActionScript 3 I discovered OAuth &#8211; an open protocol to allow secure API authorization . While reading all the stuff about OAuth and PHP SDKs, I noticed one statement somewhere (can&#8217;t find it nowhere) that Facebook was in fact using OAuth for its Facebook [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.yoz.sk/wp-content/uploads/openGraph-200x100.png" alt="" title="openGraph" width="200" height="100" class="alignleft size-medium wp-image-1474" /></p>
<p>Few days before while I was working on <a href="http://blog.yoz.sk/2010/04/twitterlogger-class-to-full-twitter-api-access-from-actionscript-3/">TwitterLogger Class for ActionScript 3</a> I discovered <a href="http://oauth.net/">OAuth &#8211; an open protocol to allow secure API authorization</a> . While reading all the stuff about OAuth and PHP SDKs, I noticed one statement somewhere (can&#8217;t find it nowhere) that Facebook was in fact using OAuth for its Facebook Connect tool but some derived version. This has now changed! Facebook is standardizing communication and authorization by introducing <strong>Open Graph</strong> and <strong>OAtuh 2.0</strong>.</p>
<p><span id="more-1462"></span></p>
<p><a href="http://www.facebook.com/f8">F8</a> is a Facebook conference to bring together the developers and entrepreneurs who are building the social Web by moving fast, taking risks, and hacking traditional systems. In <a href="http://mashable.com/2010/04/21/facebook-f8-2/">April 21, 2010, in F8 conference</a> a few interesting things have been mentioned about the new Facebook API. Facebook CEO Mark Zuckerberg announced that the Facebook Connect brand would be eliminated as part of the launch of <a href="http://mashable.com/2010/04/21/facebook-open-graph/">Open Graph</a>.</p>
<p>Update (May 5, 2010): I have created <a href="http://blog.yoz.sk/2010/05/facebook-graph-api-and-oauth-2-and-flash/"><strong>Facebook Graph API &#038; OAuth 2.0 &#038; Flash</strong></a> &#8211; FacebookOAuthGraph ActionScript 3 class to use with OAuth 2.0 and Graph</p>
<h3>Open Graph</h3>
<blockquote><p>The Open Graph API will allow any page on the Web to have all the features of a Facebook Page – users will be able to become a Fan of the page, it will show up on that user’s profile and in search results, and that page will be able to publish stories to the stream of its fans. (<a href="http://wiki.developers.facebook.com/index.php/Roadmap_Open_Graph_API">Facebook Roadmap Open Graph API</a>)</p></blockquote>
<p><a href="http://developers.facebook.com/docs/opengraph">Open Graph protocol</a> also introduces &lt;meta&gt; tags, that allows you to specify structured information about your web page when used with like button etc.</p>
<p>Here are some url examples of <a href="http://developers.facebook.com/docs/reference/api/">Graph API</a> usage:</p>
<pre class="brush: plain; title: ; notranslate">http://graph.facebook.com/[USERID]          - user’s graph for your app
http://graph.facebook.com/[USERID]/friends  - access to user’s friends
http://graph.facebook.com/[USERID]/likes    - access user’s likes</pre>
<p>By default these requests return JSON objects, but I guess there is a parameter to be passed to get xml instead (my guess).</p>
<p>Cool thing about this is there is a benevolent crossdomain file on <a href="http://graph.facebook.com/crossdomain.xml">http://graph.facebook.com/crossdomain.xml</a>:</p>
<pre class="brush: xml; title: ; notranslate">&lt;cross-domain-policy&gt;
    &lt;allow-access-from domain=&quot;*&quot;/&gt;
    &lt;site-control permitted-cross-domain-policies=&quot;master-only&quot;/&gt;
&lt;/cross-domain-policy&gt;</pre>
<p>Some of those returns &#8220;OAuthAccessTokenException&#8221; thats where new OAuth comes in scene.</p>
<h3>OAuth 2.0</h3>
<p>Second thing noticed was that the company is standardizing the authorization via the <a href="http://github.com/theRazorBlade/draft-ietf-oauth/raw/master/draft-ietf-oauth.txt">OAuth 2.0 standard</a>. The important thing here is, <strong>OAuth is already available for all existing Facebook APIs</strong>, and there are <a href="http://developers.facebook.com/docs/authentication/">multiple methods to get authenticated with OAuth in Facebook</a>. Check out the <a href="http://github.com/facebook/php-sdk/">PHP example code example code for authentication</a> on GitHub. Difference to previous connect is that sessions may last longer than 24 hours.</p>
<p>Lets hope there will be new version of <a href="http://wiki.developers.facebook.com/index.php/Flash/ActionScript">Facebook ActionScript API</a> released soon enough with all these new features&#8230;</p>
<p>Where to go from here:</p>
<ul>
<li><a href="http://developers.facebook.com/docs/authentication/">Facebook Authentication</a></li>
<li><a href="http://developers.facebook.com/docs/reference/api/">Graph API reference</a></li>
<li><a href="http://mashable.com/2010/04/21/open-graph-privacy/">Facebook Open Graph: What it Means for Privacy</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.yoz.sk/2010/04/facebook-now-with-oauth-and-open-graph/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>s.Oliver Rubik&#8217;s Cube</title>
		<link>http://blog.yoz.sk/2010/03/s-oliver-rubik-s-cube/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=s-oliver-rubik-s-cube</link>
		<comments>http://blog.yoz.sk/2010/03/s-oliver-rubik-s-cube/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 10:23:10 +0000</pubDate>
		<dc:creator>Jozef Chúťka</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Flash / Flex]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[Papervision 3D]]></category>
		<category><![CDATA[sOliver]]></category>

		<guid isPermaLink="false">http://blog.yoz.sk/?p=1309</guid>
		<description><![CDATA[The Rubik&#8217;s Cube is a 3-D mechanical puzzle invented in 1974 by Hungarian sculptor and professor of architecture Ernő Rubik. My latest project was to create a 3D engine (I have used papervision) based on this logic + integrate with facebook. Finally, the game is ready and you can play s.Oliver &#8216;s Cube on Facebook.]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.yoz.sk/wp-content/uploads/soliver.jpg" alt="" title="soliver" width="200" height="100" class="alignleft size-full wp-image-1323" /></p>
<p>The <a href="http://en.wikipedia.org/wiki/Rubik's_Cube">Rubik&#8217;s Cube</a> is a 3-D mechanical puzzle invented in 1974 by Hungarian sculptor and professor of architecture Ernő Rubik. My latest project was to create a 3D engine (I have used papervision) based on this logic + integrate with facebook. Finally, the game is ready and you can <a href="http://apps.facebook.com/soliver/">play s.Oliver &#8216;s Cube on Facebook</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yoz.sk/2010/03/s-oliver-rubik-s-cube/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>onConference &#8211; Facebook Video Chat Screencast</title>
		<link>http://blog.yoz.sk/2010/03/onconference-facebook-video-chat-screencast/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=onconference-facebook-video-chat-screencast</link>
		<comments>http://blog.yoz.sk/2010/03/onconference-facebook-video-chat-screencast/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 14:34:40 +0000</pubDate>
		<dc:creator>Jozef Chúťka</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[chat]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[onConference]]></category>
		<category><![CDATA[screencast]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://blog.yoz.sk/?p=1238</guid>
		<description><![CDATA[At last, I managed to work youtube videos on my blog using Embedded Video plugin. Watch this youtube screencast video about how to make facebook video calls with onConference application:]]></description>
			<content:encoded><![CDATA[<p>At last, I managed to work youtube videos on my blog using <a href="http://wordpress.org/extend/plugins/embedded-video-with-link/">Embedded Video plugin</a>. Watch this youtube screencast video about how to make <a href="http://apps.facebook.com/onconference/">facebook video calls</a> with <a href="http://blog.yoz.sk/2010/02/onconference-video-chat-over-facebook/">onConference application</a>:</p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yoz.sk/2010/03/onconference-facebook-video-chat-screencast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

