Search code examples
facebook-graph-apifacebook-access-tokenrestfbfacebook-app-settings

Post Pictures from facebook page using java


I want to write a macro which enables it to post/ publish pictures from a folder on my desktop on my facebook page. The pictures are generated automatically.

After hours of searching I found restfb. Nevertheless it worked well with the 1-hour access token, I wasn't able to get an token which extends 60 days.

Most tutorials I found referring this problem, says that I have to install a facebook app and give permissions to publish actions on the facebook site. I spent hours trying that, but its so difficuilt to look through the thousands of facebook settings, sdks, plattforms, products or reviews.

Furthermore I don't understand the different access tokens of site, user, app and the different ids.

I just want the 60 days access token to post on my own facebook page, why is facebook making it so difficuilt ... ?

I see many facebook pages, who post their pictures automatically to a certain time, so I am sure there is a way to do this.

So my questions are: Is there a simple tool who is allready able to do this? How can I set easily a facebook app with the permissions I needed to get the 60 days access token and to post on my own facebook page. Thank you!


Solution

  • You can exchange 60 days token by this.

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