突然,我的网页上的facebook登录停止工作-它返回消息invalid access token
。几个月前,它运行得很好。你能帮帮我吗?我使用php如下:
$facebook = new Facebook(array(
'appId' => 'xxx',
'secret' => 'xxx',
));
$userfb = $facebook->getUser();
if ($userfb) {
try {
$user_profile = $facebook->api('/me');
} catch (FacebookApiException $e) {
$userfb = null;
}
}
if ($userfb==null) {
$args = array('scope' => 'email');
echo "<tr>";
echo '<td><a href="' . $facebook->getLoginUrl($args) . '"><img src="fblogin.png" border="0" width="60" height="20"></a></td>';
echo "</tr>";
}
所有facebook令牌都会在某个时间点过期(http://developers.facebook.com/docs/facebook-login/access-tokens/),但如果你的用户已经授权了应用程序,你可以让facebook SDK在catch块中重新生成访问令牌