SammyK / LaravelFacebookSdk

Fully unit tested Facebook SDK v5 integration for Laravel & Lumen
MIT License
692 stars 200 forks source link

How do I get timeline information? #125

Closed illuminate3 closed 8 years ago

illuminate3 commented 8 years ago

I'm trying to get the latest posts off my timeline for my site. How would I go about attacking this?

Do I have to login through Oauth to do this?

I tried most of the examples given and I end up with invalid oauth token or provide an access token?

I have signed up for my ID and Secret.

Thanks!

jsrosas commented 8 years ago

I have created a long lived token for my app, so I'm trying:

$session='long lived token from facebook'`
$request = Facebook::get(
$session, 
'pageid'.
 'feed');
$response = $request->execute();
$graphObject = $response->getGraphOject();

This works on the Graph API Explorer but I keep getting

Invalid OAuth access token.

I am using the same token provided by facebook on both Graph API Explorer and Laravel.

SammyK commented 8 years ago

Hey @illuminate3!

I'm trying to get the latest posts off my timeline for my site. How would I go about attacking this?

See the /user/feed endpoint: https://developers.facebook.com/docs/graph-api/reference/user/feed

Do I have to login through Oauth to do this?

Yep! This lib should make all that easy though.

I tried most of the examples given and I end up with invalid oauth token

Can you post any specific errors you're getting or relevant code snippets?

Hey @jsrosas! This really should be on a separate issue...

I am using the same token provided by facebook on both Graph API Explorer and Laravel.

Make sure that the app you're using in your Laravel app matches the one in the Graph API Explorer. You should see a drop-down to select which app you want to use.

jsrosas commented 8 years ago

Yeah sorry I thought my code may help @illuminate3