Facebook JS SDK: Displaying oAuth dialog in iframe
I am trying to display a Facebook UI dialog inside my iframe app, so that I can get an extended permission that we don't presently have. This was easily achieved using t开发者_如何学Pythonhe old SDK. However, using the new library, I get a Facebook iframe dialog that appears modally, but never stops loading. Changing the method to "page" means I get a popup browser window that simply says "An error has occured". My code follows:
var attachment = {
display: 'iframe',
method: 'oauth',
scope: perms,
access_token: '<?php echo $this->accessToken; ?>' // this is definitely valid access token
};
FB.ui(attachment, function(response){
pr(response);
});
I'm hoping this is possible using the new SDK, the docs certainly state that iframe
is a valid display param.
Thanks in advance.
G
iframe is not a valid display param for oauth dialog because of the risk of clickjacking. Also I'd suggest to use FB.login to get an extended permission:
https://developers.facebook.com/docs/reference/javascript/FB.login/
hope this helps
This has been broken for a while. (Take a look at the bugtracker with "FB.ui permission" as search words.) A work-around is to use FB.login instead of FB.ui. This means getting a pop-up instead of an iframe, of course.
精彩评论