开发者

Get permission and begin publishing to a Facebook page wall, separate from user's account?

Using the Facebook C# SDK by Nathan Totten, how would I go about getting permission to post to a Facebook page wall, for a page ID they provide?

I've got Facebook C# SDK working to let users login using Facebook account, and making posts their own walls. However, I wish to let users enter a Facebook page ID (o开发者_开发技巧f which they are admin of) and then begin publishing to that wall.

When they click the login via Facebook button, if they've never logged in before it automatically asks for their permission. Not sure how to do this later, when the user has already granted permission to their profile info... and I want to get permission to their page wall.


To get FB permission to publish to Page Wall you need grant user manage_pages permission.

For example: https://graph.facebook.com/oauth/authorize?client_id=123456789&redirect_uri=http://example.com/&scope=publish_stream,share_item,offline_access,manage_pages

After user was granted permission to manage pages he may publish posts to the page.

For FB button you may try this:

<fb:login-button onlogin="OnRequestPermission();"></fb:login-button>

function OnRequestPermission(){
  var myPermissions = "publish_stream, manage_pages"; // permissions your app needs
  FB.Connect.showPermissionDialog(myPermissions , function(perms) {
  if (!perms) 
  {
    // handles if the user rejects the request for permissions. This is a good place to log off from Facebook connect
  }
  else
  {
      // finish up here if the user has accepted permission request
  };
});
}

I personally didn't try fb-login button, so not sure if it works correctly.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜