开发者

Facebook, write on application wall

开发者 https://www.devze.com 2023-03-30 16:10 出处:网络
I\'ve been using the Facebook C# SDK for 5 months but suddenly I started getting problems with writing on my Application wall yesterday night. To clarify, I\'m not writing on the users wall. Only on t

I've been using the Facebook C# SDK for 5 months but suddenly I started getting problems with writing on my Application wall yesterday night. To clarify, I'm not writing on the users wall. Only on the application wall.

This is the code:

string facebookmessage = "Testmessage";

var appAccessToken = "App_id|App_secret";

try
{
    var fb2 = new FacebookClient(appAccessToken);
    dynamic result = fb2.Post("/App_id/feed", new Dictionary<string, object> { { "message", facebookmessage } });
}
catch (Exception ea)
{
   Debug.WriteLine(ea.Message);
}

This worked as a charm until yesterday. The App posted the text on it's own wall as this picture shows

http://www.veikontroller.no/veikontroll_screen.png

This stopped working and is now giving me this error messa开发者_如何学Pythonge:

(OAuthException) (#200) The user has not granted the application the permission to automatically publish feed stories

I've tried to replace App_secret with the Access Token from the App developer page. This works, but the result is a post from my user on the application wall, and I don't want to display my name on the posts. If I write a post manually on the app wall in a browser on facebook.com my user is substituted with the app name a second after I have posted.

Does anyone know of changes that has been made by Facebook that may be the reason?

Best regards Øystein


Not sure the specifics of the C# API, but in general, check out the 'accounts' connection on this page: https://developers.facebook.com/docs/reference/api/user/

So

  1. Generate an access token for a user with the manage_pages permission
  2. Call https://graph.facebook.com/{uid}/accounts..which will return all the apps/pages that the user is an admin of along with access tokens that allow you to behave as the app/page
  3. Use that access token and attempt to write on the wall of the app...
0

精彩评论

暂无评论...
验证码 换一张
取 消