Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Graph API - complete server side auth and API calls

I have an application, that runs on server. On that server is background task, that will post status update on few social networks (Facebook, Twitter, G+). It must be completely server-side.

In Twitter API I'm able to use OAuth header to authorize API request. OAuth HTTP header uses consumer key, consumer secret, access token and access token secret to create the header. With this I'm able to post/update/delete tweets with no user interaction.

How can I do this for Facebook? I found a solution to obtain a long-lived access_token (2 months), but we don't want to regenerate access_token every 60 days. We want to use it for manage our Facebook page - post status updates, but completely server-side.

Am I able to do this for Facebook? Thanks for answers. PS: I searched stackoverflow hundred-times but with no solution for my problem.

Thanks.

like image 546
Jakub Dibala Avatar asked Oct 06 '14 07:10

Jakub Dibala


People also ask

What 3 terms does Facebook use to describe what the graph API is composed of?

The Graph API is named after the idea of a "social graph" — a representation of the information on Facebook. It's composed of nodes, edges, and fields.

How do you graph API on Facebook?

Register as a Facebook Developer. A Facebook App – This app will be for testing so there is no need to involve your app code when creating this Facebook App. The Graph Explorer tool open in a separate browser window. A brief understanding of the structure of the Facebook Social Graph from our Graph API Overview guide.

Is Facebook Graph API a REST API?

As you suggested, the Graph API, just like the Legacy REST API, is in fact a RESTful API.

Is Facebook Graph API deprecated?

Applies to all versions. Facebook Analytics will no longer be available after June 30, 2021. Additionally, we are deprecating the App Dashboard Plugin for Marketing API. For more information visit the Business Help Center.


1 Answers

It is not possible for User Access Tokens (they can only be extended to 60 days and need to be refreshed by the user after that), but for posting to a Page you should use a Page Token anyway. An Extended Page Token is valid forever.

Here are some Links to help you get that Extended Page Token:

  • https://developers.facebook.com/docs/facebook-login/access-tokens/
  • http://www.devils-heaven.com/facebook-access-tokens/
  • http://www.devils-heaven.com/extended-page-access-tokens-curl/

A Page Token will post "as Page" btw, but that´s probably what you want. And auto-posting on user profiles is not really allowed anyway, every message has to be 100% user generated and every posting should get authorized by the user.

like image 159
andyrandy Avatar answered Oct 31 '22 00:10

andyrandy