我正在尋找microsoft的Facebook供稿..但問題在於Facebook訪問令牌在兩個小時後過期。有沒有什麼辦法可以獲得訪問令牌,這個令牌在兩個小時後不會過期。Facebook訪問令牌在兩個小時後過期
https://graph.facebook.com/Microsoft/posts?access_token=
我正在尋找microsoft的Facebook供稿..但問題在於Facebook訪問令牌在兩個小時後過期。有沒有什麼辦法可以獲得訪問令牌,這個令牌在兩個小時後不會過期。Facebook訪問令牌在兩個小時後過期
https://graph.facebook.com/Microsoft/posts?access_token=
一些信息有關的訪問令牌,包括「擴展令牌」:
但是:爲了得到一個Facebook頁面的飼料,你只需要一個App訪問令牌,並且,一個是永遠有效。查看關於該令牌的鏈接,這很容易:「APP-ID|APP-SECRET
」 - 只是不要將其放在客戶端代碼中,祕密應該永遠不會顯示給用戶。
對於微軟而言,這將是端點:
https://graph.facebook.com/Microsoft/feed?access_token=App-ID|App-Secret
:
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>
,應該讓開了一年的連接,由於緩存控制
ü的意思是說我應該使用'https://graph.facebook.com/endpoint ?key = value&access_token = app_id | app_secret'但是我如何使用'https://graph.facebook.com/Microsoft/posts?access_token ='來獲得提要 – Hitesh
它是/ feed,而不是/ posts。我會編輯我的答案。 – luschn
這絕對不適用於任何應用程序ID或應用程序的祕密......在開發者Facebook應用程序 – Hitesh