This time, however, Graph API v2.3 has major change on /oauth/access_token response. It used to return URL encoded query string, but is going to return JSON object from its latest version. So I added several new methods and some code change as below:
- Now Facebook::OpenGraph::Response has methods for Graph API version comparison
- Facebook::OpenGraph checks API version, and if it is higher than v2.3, it parses the response body as JSON object
These version comparison methods are handy. $response->api_version returns API Version that is returned from Graph API, which I think is safer than using the version given by developers. The designated version and actual experiencing version may differ sometimes as described on document.
we now return an HTTP response header called 'facebook-api-version' which indicates which API version your app is actually experiencing - this may be different to the API version you specify in your request due to upgrades.
I am not creating brand new Facebook App lately, so there might be some edge-cases that I am missing. I will be happy to have your feedback on github.