c# - Insufficient permission to post to target on behalf of the viewer -


i have 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) httpwebrequest;                  using (httpwebresponse response = request.getresponse() 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 caption!";                 args["description"] = "this description!";                 args["name"] = "this name!";                 args["picture"] = "picutre";                 args["link"] = "http://www.bradspel.net/";                  client.post("/1418771281723422/feed", args);              }         } 

when posting :

(oauthexception - #200) (#200) insufficient permission post target on behalf of viewer

if change client.post :

client.post("/me/feed", args); 

it works fine.

so why not working when im post specific wall? have set permission on facebook page let post. facebook app set online.

by creating extended page token , use make post works fine. see : how page access token code?

im surprised simple task hard running , there vary little get.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -