我有以下代码:
$facebook = new Facebook(array(
'appId' => ID,
'secret' => SECRET,
'cookie' => true));
$fb_uid = $facebook->getUser();
if($fb_uid)
{
// check if person with fb_uid as facebook id in database,
// if so log them in. If not, register them.
$fb_user = $facebook->api('/' . $fb_uid);
I then get their email address using $fb_user['email'] and facebook_id and store in the database as a means to log them in the future
即使该人使用 facebook 登录,有时 $fb_uid 也会返回 false ...我认为这是因为访问令牌过期。如何更改此代码以合并扩展访问令牌以将用户登录到我的站点?
不推荐使用离线访问令牌,因此我需要使用扩展访问令牌。