0
votes

I am trying to use the following code to post a message on facebook wall (Facebook C# SDK - https://github.com/facebook/csharp-sdk)

Facebook.FacebookAPI api = new Facebook.FacebookAPI("my token");

JSONObject me = api.Get("/me");

var userId = me.Dictionary["id"].String;

Dictionary<string, string> postArgs = new Dictionary<string, string>();

postArgs["message"] = "Hello, world!";

api.Post("/" + userId + "/feed", postArgs);

I am able to pull the user profile information but while posting a message throwing an error message like below.

The remote server returned an error: (403) Forbidden. Description: An unhanded exception occurred during the execution of the current web request.

Exception Details: Facebook.FacebookAPIException: The remote server returned an error: (403) Forbidden.

What could be the issue ?

1

1 Answers

1
votes

Make sure userId is the proper value and make sure you have publish_stream extended permissions granted from the user.