Closed oklahomer closed 9 years ago
Checking response body if it matches with m/\A { .+ } \z/xms
to see if it's JSON formatted doesn't seem to be a smart way.
The best way I think is to see the requesting API version and parse the response body appropriately. The tricky part is that Graph API automatically decide the API version when:
So we should see the actual API version used on the current call, and parse the response body. There must be a header field that returns the API version.
facebook-api-version HTTP header is guaranteed to be given.
New 'facebook-api-version' HTTP header: In all API versions, 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.
Perfect.
The changelog states that /oauth/access_token endpoint is now returning JSON formatted string.
The detailed spec. is described at Confirming identity.
Remember they used to return the seconds till expiration with a name of "expires", but now it is named "expires_in".