php - Symfony2 and Facebook App. AccessToken from CanvasHelper empty -


i developing facebook app using symfony2. in index route (indexaction), ask user login , then, set access token in way in order retrieve info:

$helper = $fb->getcanvashelper(); $accesstoken = $helper->getaccesstoken(); $fb->setdefaultaccesstoken($accesstoken); 

until here, works fine. problem comes when redirect in way other page of app indexaction:

return $this->redirect($route, 301); 

in new page, if try execute previous code access token again, message:

the default access token must of type \"string\" or facebook\\accesstoken @ /home/promocionescentros/www/vendor/facebook/php-sdk-v4/src/facebook/facebook.php:298)"} [] 

why happening this? can access token 1 time?

thanks

just replace:

$accesstoken = $helper->getaccesstoken();

with:

$accesstoken = (string)$helper->getaccesstoken();


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -