Note to self: how to post on facebook as a page

How to obtain a long-term access token for a page and programmaticaly post to it:

From here: http://stackoverflow.com/questions/8231877/facebook-access-token-for-pages

  1. Go to the Graph API Explorer
  2. Choose your app from the dropdown menu
  3. Click “Get Access Token”
  4. Choose the manage_pages permission (you may need the user_events permission too, not sure)
  5. Now access the me/accounts connection and copy your page’s access_token
  6. Click on your page’s id
  7. Add the page’s access_token to the GET fields
  8. Call the connection you want (e.g.: PAGE_ID/events)

I didn’t do steps 7 and 8. Instead, exchange the access token from 6 with a long-term one:

https://graph.facebook.com/oauth/access_token?client_id=client_id&client_secret=client_secret&grant_type=fb_exchange_token&fb_exchange_token=short_page_access_token

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s