Php Facebook getSession在heroku上返回null
我有3个FB应用程序运行相同的代码 有一个主应用程序在本地运行代码。第一个测试应用程序也在本地运行代码。还有第三个应用程序运行相同的代码,但在Heroku实例上 当在Heroku实例上运行的应用程序失败时,第一个2可以正常工作Php Facebook getSession在heroku上返回null,php,facebook,heroku,Php,Facebook,Heroku,我有3个FB应用程序运行相同的代码 有一个主应用程序在本地运行代码。第一个测试应用程序也在本地运行代码。还有第三个应用程序运行相同的代码,但在Heroku实例上 当在Heroku实例上运行的应用程序失败时,第一个2可以正常工作 if (!$this->session) { $this->helper = new FacebookCanvasLoginHelper(); try { $this->session = $this->helper->get
if (!$this->session) {
$this->helper = new FacebookCanvasLoginHelper();
try {
$this->session = $this->helper->getSession(); # $this->helper->getSession() always return null when executed on heroku.
$_SESSION['facebook_session'] = serialize($this->session);
} catch (FacebookRequestException $e) {
scratch\Log::write($e->getMessage(), 'FacebookRequestException');
} catch (\Exception $e) {
scratch\Log::write($e->getMessage(), 'Exception');
}
}
助手似乎很好:
["signedRequest":protected] => object(Facebook\Entities\SignedRequest)#6 (2) {
["rawSignedRequest"] => string(188) "-Wlk-ju826ayyG3koaoy462wAs1AtJCyZ3iH6oJsDog.eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImlzc3VlZF9hdCI6MTQwOTkzMTk3OCwidXNlciI6eyJjb3VudHJ5IjoiZnIiLCJsb2NhbGUiOiJmcl9GUiIsImFnZSI6eyJtaW4iOjIxfX19"
["payload"] => array(3) {
["algorithm"] => string(11) "HMAC-SHA256"
["issued_at"] => int(1409931978)
["user"] => array(3) {
["country"] => string(2) "fr"
["locale"] => string(5) "fr_FR"
["age"] => array(1) {
["min"] => int(21)
}
}
}
}
我遇到的问题与Heroku上的部署有关。我试着在Heroku上设置一个FB应用程序,之前它在本地服务器上运行良好,但也失败了
欢迎有任何提示!:
编辑:更改代码示例中的注释,以使读者更清楚。序列化调用是否返回null,您是否正在验证该值,或者您只是在下一个请求中没有返回会话数据?很抱歉造成误解。实际上总是空的不是调用serialize,而是$this->session或更直接的$this->helper->getSession。你看到了吗?是的,我看到了几乎所有由SO提出的相关问题,或者通过一些研究发现的,…在本地服务器上运行应用程序时,一切正常,测试用户也能正常工作。在Heroku上运行时,它就是不起作用。我会继续关注JS认证的事情。谁知道…