SimonSays
SimonSays

Reputation: 10977

Facebook API call inside FB Application requires login (just in IE)

i made a FB application that shows the upcoming events of a public page. i use the following javascript:

<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) {
    ...
});

the code runs fine in chrome and firefox (although just when uploaded to a server and executed inside FB (https://apps.facebook.com/{app_name}/), not local or when called direct from the hosting server) but when run in IE i get this error:

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

i dont see why the user has to login, since the app anyways already runs inside FB. any ideas?

thanks simon

Upvotes: 0

Views: 511

Answers (1)

asdf_enel_hak
asdf_enel_hak

Reputation: 7650

As facebook app runs in iframe you should set up p3p policy in order to let ie runs, put this code in to your Global.asax (assuming you are on asp.net):

protected void Application_BeginRequest(Object sender, EventArgs e)
{

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

}

Upvotes: 0

Related Questions