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

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -