Get page information without being logged in to facebook, only by token

Asked

Viewed 93 times

0

I’m creating a Facebook posting system and it’s all right, except for one thing. When I drop Facebook by the system I’m doing, some functions don’t work, no matter how much I pass the access token of the user or page.

I’m using a library Facebook SDK for Codeigniter:

//METODO, POINT, PARAMS, TOKEN
$query = $this->request('get', '/'.$idPage, null, $row->token);

What he returns to me is:

You must provide an access token.

I need it working, because the system will have the CRON and need to make the posts on the page without the user being logged in

The permissions I’m getting are:

  • manage_pages
  • publish_pages
  • pages_show_list
  • public_profile
  • publish_actions
  • email
  • user_managed_groups
  • user_posts
  • user_likes
  • For all Facebook requests it is necessary to inform the access_token user. Simply store the access_token and uses it in cron normally, there is no mystery in it. The fourth parameter ($row->token) seems to be the token, if it’s just take the token stored and using it normally.

  • @Inkeliz Yes, this variable is the token, but even passing the token to the $this->request it does not work. I tried to pass the user and the page and none works.

1 answer

0

SOLUTION FOUND!

The function request() makes various types of request to facebook. When I use the POST it is necessary to pass the parameters, thus:

$query = $this->request('post', '/'.$idPage, $parametros, $row->token);

Like I’m trying to make a GET, then in place of $parametros i need to send the token directly:

$query = $this->request('get', '/'.$idPage, $row->token);

That way it worked.

Library link to Codeigniter 3.x: https://github.com/darkwhispering/facebook-sdk-codeigniter

Browser other questions tagged

You are not signed in. Login or sign up in order to post.