3
votes

Is there a way to pull Facebook content (specifically wall posts from a public page) to display on a website without Facebook requiring a user login? Before the offline_access permission was deprecated, I would simply create a token as myself, store it, and pull the information as needed.

Now, from what I can figure out, the only two options I have are to 1) manually update that token every 60 days, or 2) display the content only to Facebook users AND make them "allow" the app. Obviously #1 is not a preferred option, and #2 doesn't seem like very good practice.

For reference, I'm only trying to pull content from a publically accessible page wall and require no action on behalf of the user (no wall posting, no reading stream, etc).

This seems like a really simple concept, and I feel like I have to be missing something. I can't find an answer anywhere. Are these really my only two options? Any feedback would be much appreciate.

Updated:

I think I may have found a way around this. With offline_access being deprecated, there is an fb_exchange_token option available to extend the expiration of an existing token. With a call to the following:

https://graph.facebook.com/oauth/access_token?client_id={app_id}&client_secret=
{app_secret}&grant_type=fb_exchange_token&fb_exchange_token={existing_token}

you should receive a token with an extended expiration. In my scenario, I will allow the app through my own Facebook account, store the token in my PHP code, and just use cURL to periodically update the existing code.

Note: According to the Facebook documentation, the expiration can only be extended once per day

1
Before the offline_access permission was deprecated, I would simply create a token as myself, store it, and pull the information as needed. Then if you change your password or your session change for security reasons you need to get another access token again & i'm not sure it be possible after deprecating offline access (i think it be available again)Pooya Estakhri
@korysharp Did this work for you? I am trying to do the same thing. Do you have an example of how you accomplished this?MicFin
@MicFin I am currently using graph.facebook.com{page_url}/feed?access_token={app_token} where page_url is the url of the page (ie: cocacola) and app_token represents an Application Access token. Take a look at stackoverflow.com/questions/12948809/… for instructions on obtaining one of these. I've been able to store and use this single token (which has no expiration) for all of our websites. Hope this helps.Kory Sharp
@KorySharp that works excellent but I did run into an issue. For some users it works fine but when I use it on other users I receive the error Koala::Facebook::ClientError: type: OAuthException, code: 803, message: (#803) Cannot query users by their username (benaffleck) [HTTP 404] from /Users/Raevynheart/.rvm/gems/ruby-2.1.2/gems/koala-1.10.0/lib/koala/api/graph_api.rb:503:in `block in graph_call' any suggestions?MicFin
@McFin this method will only work for pages that have public access (no privacy settings). The pages that i use this for in my cases are clients of ours that have public pages. Is the Ben Affleck account a "page" or a regular user account?Kory Sharp

1 Answers

0
votes

Assuming you own the page you can use the manage_pages permission. The manage_pages permission is a permanent token from what I can gather. Then use /feed on the graph api with the relevant page number to pull the information.

I am assuming you own this page. If you don't or aren't explicitly given permission then you don't have the rights to pull this information down.