<?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>redirect_to :hack &#187; Facebook</title>
	<atom:link href="http://blog.coderubik.com/category/facebook/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.coderubik.com</link>
	<description>Thoughts on Ruby on Rails and Facebook development</description>
	<lastBuildDate>Thu, 07 Apr 2011 21:49:38 +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>Cookies and Facebook canvas apps</title>
		<link>http://blog.coderubik.com/2011/03/cookies-and-facebook-canvas-apps/</link>
		<comments>http://blog.coderubik.com/2011/03/cookies-and-facebook-canvas-apps/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 22:38:26 +0000</pubDate>
		<dc:creator>Pierre Olivier Martel</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.coderubik.com/?p=187</guid>
		<description><![CDATA[With the new Facebook way of loading iframes apps with POST requests, the safari third-party cookie problem is now partly fixed. It has always been a big headache dealing with cookies on the Facebook platform since Safari rejects them by default. With POST requests however, it is now possible to set cookies from the server. [...]]]></description>
			<content:encoded><![CDATA[<p>With the new Facebook way of loading iframes apps with <a href="http://developers.facebook.com/docs/canvas/post/">POST requests</a>, the safari third-party cookie problem is now partly fixed. It has always been a big headache dealing with cookies on the Facebook platform since Safari rejects them by default. With POST requests however, it is now possible to set cookies from the server. It seems Safari will still reject cookies set from the client.</p>
<p>So if you are using the Facebook Javascript SDK and set the cookies option to true, Safari won&#8217;t accept the FBS_XXXX cookie planted by the SDK. I struggled a whole week-end before <a href="http://forum.developers.facebook.net/viewtopic.php?pid=321880">figuring it out</a>.</p>
<p>The work-around I use is to set a cookie from the server with the signed_request in it if there is one present. This solves most of the problems since I can just use the cookie when I don&#8217;t have a fresh signed_request (this happens when I do a request inside the canvas).</p>
<p>Here is the code inside a before_filter in the application_controller. I use Rails with the <a href="https://github.com/mmangino/facebooker2">Facebooker2</a> gem :</p>
<p><script src="https://gist.github.com/861227.js?file=facebook_cookie.rb"></script></p>
<p>The P3P header is used to make IE6 and IE7 accept the cookie as well.</p>
<p>If you&#8217;re building a Facebook canvas application with Rails, take the time to also read <a title="Restful Facebook canvas app with Rails and POST For Canvas" href="http://blog.coderubik.com/2011/03/restful-facebook-canvas-app-with-rails-and-post-for-canvas/">my post about keeping your REST architecture with the POST requests</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.coderubik.com/2011/03/cookies-and-facebook-canvas-apps/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Restful Facebook canvas app with Rails and POST For Canvas</title>
		<link>http://blog.coderubik.com/2011/03/restful-facebook-canvas-app-with-rails-and-post-for-canvas/</link>
		<comments>http://blog.coderubik.com/2011/03/restful-facebook-canvas-app-with-rails-and-post-for-canvas/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 18:49:16 +0000</pubDate>
		<dc:creator>Pierre Olivier Martel</dc:creator>
				<category><![CDATA[Facebook]]></category>

		<guid isPermaLink="false">http://blog.coderubik.com/?p=178</guid>
		<description><![CDATA[Update: The rack middleware is now included in Facebooker2. If you&#8217;re using Facebooker2, see the readme for details. Starting March 10th, The POST for canvas option will become mandatory for all Facebook canvas apps. This means all requests to your iframe originating from the Facebook frame will be POST requests. If you use restful controllers [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>Update: The rack middleware is now included in <a href="https://github.com/mmangino/facebooker2">Facebooker2</a>. If you&#8217;re using Facebooker2, see the readme for details.</strong></em></p>
<p>Starting March 10th, The <a href="http://developers.facebook.com/docs/canvas/post/">POST for canvas</a> option will become mandatory for all Facebook canvas apps. This means all requests to your iframe originating from the Facebook frame will be POST requests. If you use restful controllers in your app, this is not a good news. Fortunately, there is a very easy way to convert those POST back to GET with a Rack middleware :</p>
<p><script src="https://gist.github.com/858939.js?file=facebook.rb"></script></p>
<p>Since all request coming from Facebook will include a <code>signed_request</code> parameter, you can assume that these requests are coming from the top frame. Other requests made directly from your iframe won&#8217;t be altered. You can safely now safely use  Post for canvas and continue to assume all requests coming from the top frame will be get requests.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.coderubik.com/2011/03/restful-facebook-canvas-app-with-rails-and-post-for-canvas/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Create a Facebook poll</title>
		<link>http://blog.coderubik.com/2010/11/create-a-facebook-poll/</link>
		<comments>http://blog.coderubik.com/2010/11/create-a-facebook-poll/#comments</comments>
		<pubDate>Mon, 22 Nov 2010 23:49:08 +0000</pubDate>
		<dc:creator>Pierre Olivier Martel</dc:creator>
				<category><![CDATA[Facebook]]></category>

		<guid isPermaLink="false">http://blog.coderubik.com/?p=169</guid>
		<description><![CDATA[I recently launched an application that lets you create your polls on Facebook and publish them on your fan page. This was something I wanted to do for a while since I thought there were no good polling apps on Facebook. With Poll for Facebook, you can add as many questions as you want to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://apps.facebook.com/my-polls/welcome"><img class="alignleft" style="margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px;" title="Create your poll on Facebook" src="http://blog.coderubik.com/wp-content/uploads/2010/11/logo_180px.png" alt="" width="180" height="168" /></a>I recently launched an application that lets you create your polls on Facebook and publish them on your fan page. This was something I wanted to do for a while since I thought there were no good polling apps on Facebook.</p>
<p>With Poll for Facebook, you can add as many questions as you want to your poll, images and invite your friends to answer it. There is a free and a Premium version.</p>
<p>I encourage you to <a href="http://apps.facebook.com/my-polls/welcome">try it</a> and give me your feedback. It is now available in English, French, Spanish and German.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.coderubik.com/2010/11/create-a-facebook-poll/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Speeding up Tunnlr</title>
		<link>http://blog.coderubik.com/2009/09/speeding-up-tunnlr/</link>
		<comments>http://blog.coderubik.com/2009/09/speeding-up-tunnlr/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 20:24:21 +0000</pubDate>
		<dc:creator>Pierre Olivier Martel</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://modelix.net/?p=51</guid>
		<description><![CDATA[When developing a Facebook or Facebook Connect application, there are times when Facebook servers will need to directly make requests to your application. This means your local web server has to be remotely accessible for incoming requests. Typically, when working locally, your mongrel or webrick instance running on port 3000 is not accessible unless you [...]]]></description>
			<content:encoded><![CDATA[<p>When developing a Facebook or Facebook Connect application,  there are times when Facebook servers will need to directly make requests to your application. This means your local web server has to be remotely accessible for incoming requests.</p>
<p>Typically, when working locally, your mongrel or webrick instance running on port 3000 is not accessible unless you enable port forwarding on your router. And even then, your <span class="caps">ISP </span>probably doesn’t assign you a fixed IP address which means you have to run a dynamic IP address service like <a href="http://www.dyndns.com">dyndns</a>. This quickly gets complicated and if you work behind a corporate network or develop from different locations (ex.: home, office, Starbucks…), this solution won’t even work.</p>
<p>Meet <a href="http://www.tunnlr.com">Tunnlr</a>, an easy to use service that makes your local Rails server accessible from the Internet by just typing a single rake command in your console. When you register to the service, you will be assigned a fixed <span class="caps">URL </span>address with a port number and this is the address you will use to configure your Facebook application and access it locally.</p>
<p>One downside to that approach is that since each request has to do a return trip to the Tunnlr servers, you loose the lightning speed loading time you’re used to when developing from your local machine (no network latency). I found a little hack that will bypass the need to do a return trip and it can be done in three easy steps</p>
<p><strong>1- Modify your <code>/etc/hosts</code> file and add the following line :</strong></p>
<pre class="brush: plain; title: ; notranslate">127.0.0.1	web1.tunnlr.com</pre>
<p>This tells your machine to route all requests made to the <code>web1.tunnlr.com</code> address to your local machine. Unfortunately, there is no way to specify port redirections in the hosts file so we need step 2 and 3 to make sure our remote and local ports are the same.</p>
<p><strong>2- Modify your tunnlr.yml or facebooker.yml file to make your local port the same as your remote port. In my case, this is port 10524.</strong></p>
<pre class="brush: plain; title: ; notranslate">
remote_port: 10524
local_port: 10524
</pre>
<p><strong>3- Start your Rails server with the same port that has been assigned to you by Tunnlr.</strong><br />
[/code]script/server -p 10524[/code]</p>
<p>That’s it! Now when you query <code>web1.tunnlr.com</code> your local requests will stay local and your server will still be remotely accessible from the tubes!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.coderubik.com/2009/09/speeding-up-tunnlr/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
