2011-06-08 27 views
0

我做了一個FB應用程序,顯示即將發生的公共頁面事件。我用下面的javascript:FB應用程序中的Facebook API調用需要登錄(只在IE中)

<script src="https://connect.facebook.net/en_US/all.js"></script> 
... 
FB.init({ 
    appId : {APP_ID}, 
    status : true, // check login status 
    cookie : true, // enable cookies to allow the server to access the session 
    xfbml : true // parse XFBML 
}); 

FB.api('/{page_id}/events?since=today', function(response) { 
    ... 
}); 

代碼運行在瀏覽器和Firefox細(雖然只是當上傳到服務器和內部FB執行(https://apps.facebook.com/{app_name}/),沒有本地或當從託管服務器直接調用),但在IE中運行時,我得到這個錯誤:

{ 
    "error": { 
     "type": "OAuthAccessTokenException", 
     "message": "An access token is required to request this resource." 
    } 
} 

我不明白爲什麼用戶必須登錄,因爲在應用程序中FB反正已經運行。有任何想法嗎?

感謝 西蒙

回答

0

如Facebook應用程序在運行的iframe你應該建立P3P策略,以讓即運行, 把這個代碼到您的Global.asax(假設你是在asp.net):

protected void Application_BeginRequest(Object sender, EventArgs e) 
{ 

    HttpContext.Current.Response.AddHeader("p3p", "CP=\"CAO PSA OUR\""); 

} 
相關問題