PROBLEM:2nd call to the graph api fails every time with Bad Request 400 error
If I do the following things, I can never get past #4.
Authenticate with facebook to get authtoken. It redirects back to the page with code querystring param
I get the authtoken from param and make a call to the following url string url = "https://graph.facebook.com/me?access_token=" + Token; (any graph api call works fine on the f开发者_开发百科irst call)
I get json data back. No problem. Now I have the id info from facebook.
I try to repeat the process. Every call to https://graph.facebook.com/me/xxxxxx fails. If I try getting a new token or using the initial token I get Bad Request 400 error.
There must be an order of operations that needs to occur (requests and getting tokens) that I don't understand.
(IT IS NOT AN apikey or apisecret PROBLEM)
What you describe should work. Be sure that when you get the 400-Bad Request error that you catch the WebException and read the content of the Response. It should provide you with the reason the API call failed. The catch portion of your try/catch block would look something like this:
catch (WebException ex)
{
using (StreamReader reader = new StreamReader(ex.Response.GetResponseStream()))
{
string jsonMessageString = reader.ReadToEnd();
}
}
Try this API, it's new and supported. (ie. I support it) See if it's authentication resolves your issue. If you're like me then this would have saved you hours of time fiddling with it. Well worth the 50 bucks.
精彩评论