0
votes

using facebook sdk v 6 for .net i want my server to create a post to a user wall using facebook app

My code:

    var client = new FacebookClient();
    dynamic result = client.Get("oauth/access_token", new { 
        client_id = appId,
        client_secret = appSecret,
        grant_type = "client_credentials"
    });

    client.AccessToken = result.access_token;

    var args = new Dictionary<string, object>();
    args["message"] = "abc";
    args["caption"] = "This is caption!";
    args["description"] = "This is description!";
    args["name"] = "This is name!";

    client.Post("user/feed", args);

app configuration: extended permissions : publish_stream , read_stream , export_stream, status_update ,share_item user permissions : user_about_me, publish_actions visible to all users sandbox mode : disabled appdomains : localhost Website with Facebook Login - site url:localhost:8085

this 'user' im trying to publish on his wall is a TEST user in my app. now, when i get to client.Post("user/feed", args); it throws this exception:

(OAuthException - #200) (#200) The user hasn't authorized the application to perform this action

solution ?

1

1 Answers

2
votes

you are using app's token to post on user's wall - that's not allowed. Your USER should give permissions to your app - and in return you will get USER token - and you should use it in API calls.