I have the following code:
private void CheckAuthorization() { string app_id = "x"; string app_secret = "x"; string scope = "publish_stream,publish_actions"; if (Request["code"] == null) { Response.Redirect(string.Format( "https://graph.facebook.com/oauth/authorize?client_id={0}&redirect_uri={1}&scope={2}", app_id, Request.Url.AbsoluteUri, scope)); } else { Dictionary<string, string> tokens = new Dictionary<string, string>(); string url = string.Format("https://graph.facebook.com/oauth/access_token?client_id={0}&redirect_uri={1}&scope={2}&code={3}&client_secret={4}", app_id, Request.Url.AbsoluteUri, scope, Request["code"].ToString(), app_secret); HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest; using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) { StreamReader reader = new StreamReader(response.GetResponseStream()); string vals = reader.ReadToEnd(); foreach (string token in vals.Split('&')) { //meh.aspx?token1=steve&token2=jake&... tokens.Add(token.Substring(0, token.IndexOf("=")), token.Substring(token.IndexOf("=") + 1, token.Length - token.IndexOf("=") - 1)); } } string access_token = tokens["access_token"]; var client = new FacebookClient(access_token); //client.Post("/me/feed", new { message = "A simple test" }); var args = new Dictionary<string, object>(); args["message"] = "abc"; args["caption"] = "This is caption!"; args["description"] = "This is description!"; args["name"] = "This is name!"; args["picture"] = "picutre"; args["link"] = "http://www.bradspel.net/"; client.Post("/1418771281723422/feed", args); } }
When publishing, I get the following:
(OAuthException - # 200) (# 200) Insufficient permission to publish to the target on behalf of the viewer
If I change client.post to this:
client.Post("/me/feed", args);
It works great.
So why doesnโt it work when I am going to post a specific wall? I set permission on this facebook page so that everyone can post messages. The facebook application is installed online.
source share