Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 the 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

like image 398
GeeH Avatar asked Nov 13 '22 16:11

GeeH


1 Answers

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

like image 193
Anatoly Lubarsky Avatar answered Dec 28 '22 08:12

Anatoly Lubarsky