I’m developing a desktop application and I want to subscrbe to Facebook Realtime API.
This is my code on the client (WPF app):
After my code is executed, at fb.Post I get the following error: (OAuthException) (#15) This method is not supported for native apps.
I also tried the code from ASP.NET and got the same error, so I don’t this the message is very intuitive.
How can I solve this problem and succesfully subscribe to Facebook Realtime API?
var tokenUrl = "https://graph.facebook.com/oauth/access_token?client_id=" + Constants.Facebook.AppId + "&client_secret=" + Constants.Facebook.AppSecret + "&grant_type=client_credentials";
var requestToken = WebRequest.Create(tokenUrl);
HttpWebResponse res = (HttpWebResponse)requestToken.GetResponse();
Stream resst = res.GetResponseStream();
var sr = new StreamReader(resst);
string responseToken = sr.ReadToEnd();
var app_access_token = responseToken.Replace("access_token=", "");
var callback_url = "[MY CALLBACK URL]";
var fb = new FacebookClient(app_access_token);
var parameters = new Dictionary<string, string>();
parameters.Add("object", "user");
parameters.Add("fields", "feed");
parameters.Add("callback_url", callback_url);
parameters.Add("verify_token", "abc");
parameters.Add("access_token", app_access_token);
var uri = string.Format("https://graph.facebook.com/{0}/subscriptions?", Constants.Facebook.AppId);
var response = fb.Post(uri, parameters);
Your application configured as “Native Application” in developer app (advanced settings) and as stated in error this type of apps can’t use Real-Time updates (sounds like a good reason to me).
Documentation for Real-Time Updates omit this info, you can file a bug and see what officials say…