Facebook Access令牌将在两小时后到期

时间:2013-11-25 08:09:33

标签: facebook facebook-graph-api

我正在寻找微软的facebook提要..但问题是Facebook Access令牌在两小时后到期。有没有办法获得两小时后不会过期的访问令牌。

https://graph.facebook.com/Microsoft/posts?access_token=

3 个答案:

答案 0 :(得分:2)

查看有关Facebook开发者的Expiration and Extending Tokens文档。我想这会解决你的问题。

答案 1 :(得分:1)

有关访问令牌的一些信息,包括“扩展令牌”:

但是:要获取Facebook页面的订阅源,您只需要一个App Access令牌,而且该页面永久有效。查看有关该令牌的链接,这很容易:“APP-ID|APP-SECRET” - 只是不要将它放在客户端代码中,用户永远不会看到这个秘密。

对于Microsoft,这将是端点:

https://graph.facebook.com/Microsoft/feed?access_token=App-ID|App-Secret

答案 2 :(得分:0)

FB.init中的

FB.init({
        appId: 'xxxxxxxxx', // App ID
        channelUrl: '//yourdomain/channel.php', // Channel File
        status: true, // check login status
        cookie: true, // enable cookies to allow the server to access the session
        frictionlessRequests: true, // enable frictionless requests     
        xfbml: true  // parse XFBML
    });

其中channelUrl是:

<?php
$cache_expire = 60 * 60 * 24 * 365;
header("Pragma: public");
header("Cache-Control: max-age=" . $cache_expire);
header("Expires:" . gmdate("D, d M Y H:i:s", time() + $cache_expire) . " GMT");
?>

<script src="//connect.facebook.net/en_US/all.js"></script>  

由于缓存控制

,应该使连接打开一年
相关问题