facebook - Posting to FB using Graph API -


i want make facebook post once day using ruby script , koala gem. want able set once , not have keep changing access toekns. after reading posts , facebook documentation around access tokens implemented following:

  • created facebook app
  • used graph api explorer access token myself - lasts 2 hours
  • used following script exchange short term token long term token lasts 2 months
 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  
  • wrote following rake task post facebook wall
 token = "caaflzaphvbo8..." @graph = koala::facebook::api.new(token) @graph.put_connections("me", "feed", :message => "my message!") 

with of setup, script works! writes wall every day based on scheduler.

my question is: setup have manually go , create new short term access token using graph api explorer , use long term access token every 2 months. also, have go in , manually change token = "blah blah" statement in y script. can avoided @ all? have given app created permission post wall. there way automatically new access tokens within script using koala (or other gems/libs)?

once user has given app publish_actions permission, can use app access token publish wall posts in name – have exchange me actual user id (because without user access token api can’t know “me” supposed be).

and combination app_id|app_secret (pipe symbol in middle) can serve app access token.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -