I have a page tab application where I get the page id from a signed request. To get the page i call this function.
$facebook_page_id = get_Fb_Page_Id();
The problem is that this only works the first time I call the function. Why is this?
En exmaple would be that I have a startpage which returns some results but also a page that returns search results. The function only works on the startpage but not when returning search results.
Here is my function.
function get_Fb_Page_Id() {
$fb = App::make('SammyK\LaravelFacebookSdk\LaravelFacebookSdk');
$helper = $fb->getPageTabHelper();
try {
$token = $fb->getCanvasHelper()->getAccessToken();
} catch (Facebook\Exceptions\FacebookSDKException $e) {
// Failed to obtain access token
dd($e->getMessage());
}
// $token will be null if the user hasn't authenticated your app yet
if (! $token) {
// . . .
}
$id = $helper->getPageId();
return $id;
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire