Use of Facebook API with JS-SDK on iFrame canvas page in Safari broken

So, I'm trying to use the Graph API with the Facebook JS SDK, and I get the following error in Safari:

"OAuthException: access token should be used to request information about the current user.

I suspected that this was because Safari was very strict with the cookie settings for x-domain, so I tried it in Firefox with the option cookieset to false in FB.init(). I really found myself getting the same error for my queries FB.api().

FB.init({
  appId:  "<%= app_id %>",
  status: true, // check login status
  // We cannot rely on this cookie being set in an iframe. I found this
  // out because the Graph API was not working in Safari.
  // cookie: true, // enable cookies to allow the server to access the session
  xfbml:  true, // parse XFBML
  channelUrl: window.location.protocol + '//' + window.location.host + '/fb/canvas/channel.html'
});

So I'm wondering ... is there a good way to manually set the request parameter access_tokenin the request FB.api()?

If the cookie FB.init()is configured correctly, here is what the request parameters look like FB.api():

access_token  xxxxxxxxxxxx|1.xxxxxxxxxxxxxxxxxxxxxx__.3600.xxxxxxxxxx-xxx|xxxxxxxxxxxxxxxxxxxxxxxxxxx
callback      FB.ApiServer._callbacks.xxxxxxxxxxxxxxx
pretty        0
sdk           joey

Safari ( cookie FB.init() ) FB.api() :

callback      FB.ApiServer._callbacks.xxxxxxxxxxxxxxx
pretty        0
sdk           joey

... , access_token ... , FB.api() access_token.

+5
2

, . , FB.init() cookie: true, FB.api() - access_token:

FB.api("/me/apprequests/?access_token="+access_token, function (response) {});

access_token - JS, . ERB:

<script>
  var access_token = "<%= @access_token %>";
</script>

@access_token - oauth access_token, POST.

+4

Safari , iframe cookie, ... . Safari, webkit, Chrome .

, ( ), , , , . , , javascript, . Safari cookie.

Facebook

+3

All Articles