While migrating "Our 1st FB App" from the old PHP client library to the PHP SDK, I have encountered issues in requesting the "publish_stream" permission. I have been searching information in the net and seeking help in Facebook's forum.

It seems to me that nothing had been documented on this (request permission in a Facebook canvas application built on top of the PHP SDK). Fortunately, by looking at the code of the old PHP client library and the PHP SDK, I have found a way to solve the problem. Right after testing the solution, I think it would be helpful to share, not just the code, but also what I have learnt from this solution with all new Facebook developers (I am one in the group too!).

 

What Facebook Developers are doing?

We know Windows developers are developing software that run on the windows platform, web developers are designing/writing web pages, and developing web applications. But what Facebook developers do?

According to Facebook's documentation,

So Facebook developers are

(meanwhile, let's ignore the 3rd category "devices")

 

Facebook's Development Platform & Tools

To help us (the Facebook developers), Facebook team has provided to us numerous APIs (including the old REST API and the new Graph API), SDKs and client libraries (such as the old PHP client library and the new PHP SDK).

 

The Position of the PHP SDK

Bearing in mind that "Our 1st FB App" is an application on Facebook.com, let's take a look at how Facebook's documentation say about the PHP SDK:

To conclude, I would say the PHP SDK is designed / written with the mind set that facilitates facebook developer to integrating their website with Facebook.com but NOT FOR developing app on Facebook! This is probably the reason why nearly all the samples that we found online for the PHP SDK are for integrating website with Facebook.com.

Having saying that, while those SDKs and client libraries will finally make use of the Facebook platform (including the APIs, authentication mechanism etc), there should not be big differences if we are developing "app on Facebook" or integrating our web sites with Facebook.com. "Requesting permission in app on Facebook" is the only issue that I have noticed so far.

 

After knowing the above, the solution for requesting permission in app on Facebook is easy to understand! Stay tuned for the next tutorial.....