简体   繁体   English

Facebook扩展访问令牌登录

[英]facebook extended access token login

I have the following code: 我有以下代码:

 $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

Sometimes $fb_uid returns false even though the person is logged in using facebook ... I think it is because the access token expires. 有时即使该人使用facebook登录,$ fb_uid也会返回false。我认为这是因为访问令牌已过期。 how can I change this code to incorporate the extended access token to log in the user to my site? 如何更改此代码以合并扩展访问令牌以将用户登录到我的网站?

offline access token is deprecated, so I need to use the extended access token. 离线访问令牌已被弃用,因此我需要使用扩展访问令牌。

Your cookie is expiring. 您的Cookie即将到期。 Instead of using a cookie and screen-scraping, use OAuth. 不要使用Cookie和屏幕抓取功能,而要使用OAuth。

See example here: http://eggie5.com/20-getting-started-w-facebook-api 在此处查看示例: http : //eggie5.com/20-getting-started-w-facebook-api

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM