hanleyhansen
hanleyhansen

Reputation: 6437

Facebook Store Access Token to Post to Wall Later

With offline_access being deprecated is it possible to store a user's access_token and post to that user's wall sometime in the future?

Upvotes: 0

Views: 926

Answers (1)

complex857
complex857

Reputation: 20753

Yes it is, but if you want to make those tokens useful in more than one or two hours (default expiration now), you need to exchange them for a long-living one (60 days lifetime).

There's a manual page dedicated for this permission removal, the part that you are interested in is the Scenario 4: Client-side OAuth and Extending Access_Token Expiration Time through New Endpoint. It comes down to simply adding one more http request on the server side before saving the token for later use to this endpoint:

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 

The result should be an access token and an expiration time somewhere near 60 days.

Upvotes: 5

Related Questions