Alexander  Pravdin
Alexander Pravdin

Reputation: 5579

Facebook API v2.2 incorrect endpoint response format?

The official Facebook Docs says following for API v2.2:

All API endpoints will now always return valid JSON

But when I call this endpoint:

https://graph.facebook.com/v2.2/oauth/access_token

It returns a flat string instead of a JSON if successful:

HTTP/1.1 200 OK
...
access_token=XXX&expires=5182351

But the same endpoint returns JSON if failed:

HTTP/1.1 400 Bad Request 
...
{"error":{"message":"This authorization code has expired.","type":"OAuthException","code":100}}

Is it a bug in API or a mistake in the Docs?

Upvotes: 0

Views: 217

Answers (1)

phwd
phwd

Reputation: 19995

Sounds more like an oversight in semantics than anything.

The oauth/access_token is an entry point for the API, whereas the majority of other points that have graph.facebook.com as the base, consume the access token obtained from there.

i.e. graph.facebook.com/{object}?access_token=ACCESS_TOKEN

Filing a documenation bug would be the best way to find out for sure.

Upvotes: 1

Related Questions