我正在尝试为我的画布应用程序集成 facebook。当我使用以下代码从 facebook 运行应用程序时
// init app with app id (APPID) and secret (SECRET)
FacebookSession::setDefaultApplication('xx','xx');
$helper = new FacebookCanvasLoginHelper();
try {
$data = array('oauth_token' => 'token');
$data['algorithm'] = 'HMAC-SHA256';
$data['issued_at'] = time();
$base64data = base64_encode(json_encode($data));
$rawSig = hash_hmac('sha256', $base64data, 'app_Secret', true);
$sig = base64_encode($rawSig);
$signedRequest = $sig.'.'.$base64data;
$_GET['signed_request'] = $signedRequest;
$session = $helper->getSession();
} catch(FacebookRequestException $ex) {
echo $ex;
} catch(\Exception $ex) {
echo $ex;
}
整个页面只是变成空白的白色,因为 $_GET['signed_request'] = $signedRequest;.
我应该怎么做才能登录。如果我只是这样做 $session = $helper->getSession();
而不是 Get,我会得到无效的签名参数 oAuth 数据丢失。