3

This might be a very simple question, but I just need to have a JSON response from Facebook for ths query

https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id='my app id'&client_secret='my secret id'&fb_exchange_token='old_token'

This works and returns a response with a long term Facebook token. But I just need to have the response in JSON format. How can I do that?

1 Answer 1

5

Unfortunately, this is one of the only calls in the Facebook API that does not return JSON. You can reference the still open bug on the Facebook developers site:

https://developers.facebook.com/bugs/351715371565218

I use the FB .NET SDK and retrieve the new token thusly:

newAccessToken = responseString.Split('=', '&')[1];
3
  • What language are you using? Do you need assistance reading the response from the query? May 19, 2014 at 22:34
  • Its just Javascript. The response is something like this "access_token='token'&expires='expiry time'" I was thinking of using the simple Javascript split to extract. IS there a better way to do it? May 19, 2014 at 22:37
  • It sounds like you know how to handle it - treating the response as an array and performing a split to break apart the component parts. I will edit my answer to show how I handle it in .NET May 19, 2014 at 22:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.