我試圖訪問Facebook API的公共Facebook頁面的帖子,但我似乎無法驗證即使所有正確的憑據。 FB.api返回:如何驗證Facebook應用使用JavaScript API訪問公共頁面feed?
{"error":{"type":"http","message":"unknown error"}}
而且也記錄在 '訪問令牌1:1號線' 的錯誤
Uncaught ReferenceError: TRJg376YTvXfk6sMur4Mggh5YnU is not defined access_token:1
(匿名函數)
下面是我使用的代碼:
<script src="http://connect.facebook.net/en_US/all.js"></script>
<div id="fb-root"></div>
<button name="my_full_name" onclick="connectToFacebook()" value="My Name" />
<script>
function connectToFacebook() {
FB.api('https://graph.facebook.com/oauth/access_token',
'get',
{client_id:'xxxxxxxxxx', client_secret:'xxxxxxxxxx',grant_type:'client_credentials'}, //client_credentials
function(response) {
alert(JSON.stringify(response));
});
FB.api("/publicpage/feed",
function (response) {
console.log(response);
});
}
</script>
它的網站上沒有很好的記錄!有任何想法嗎?
這個端點應該只能被_server-side_ apps使用 - 因爲它需要你的應用程序祕密,而你不想在客戶端JS代碼中公開那些每個人都能找到它的東西。 – CBroe