Mike Keskinov
Mike Keskinov

Reputation: 11898

Facebook post on page

I'm using Facebook SDK 6 and Graph API to publish data from app (ASP.NET) to the page.

Firstly, my app (website) get access token using server flow as described here. Next, it use this token to publish some text in my page:

    Dim fb = New FacebookClient(accessToken)
    Dim o As Dictionary(Of String, Object) = New Dictionary(Of String, Object)
    o.Add("message", "some text...")
    Dim result = fb.Post("/TfdTest/feed", o)

To test it, I browse my website. I allow my site change my facebook page and give permissions (publish_stream, manage_pages). The problem is that final feed appears in "Recent Posts by Others" section:

enter image description here

How can I post feed from page name, not from myself???

Upvotes: 2

Views: 1719

Answers (1)

avs099
avs099

Reputation: 11227

in order to use Graph API on behalf of a Page, you need to get Page access token - see here for more details: https://developers.facebook.com/docs/authentication/pages/

  1. Authenticate the user and request the manage_pages permission
  2. Get the list of pages the user manages using token from (1) - https://graph.facebook.com/me/accounts?access_token=USER_ACCESS_TOKEN
  3. Parse the list and get the PAGE token - and use it to post to the feed.

Upvotes: 3

Related Questions