Gautam
Gautam

Reputation: 21

Asking facebook permissions dialog inside iframe

Im trying to put the facebook permissions dialog within an iframe, however not making much progress because of lack of Facebook documentation, and the undocumented hacks around web are not working any more.

news.yahoo.com does something that i would like to emulate.

When you click on a news article it says login with facebook. After the initial oauth dialog to authenticate the user ( which does not ask for permissions), yahoo pop's another dialog from a yahoo URL which included the Permissions dialog within as an IFrame.

Does anybody know what API's can be used to accomplish this?

The fiddler trace indicates that the yahoo URL is calling:

the uiserver.php endpoint with the permissions.request method.

https://www.facebook.com/connect/uiserver.php?method=permissions.request&app_id=194699337231859&display=iframe&redirect_uri=https%3A%2F%2Fopen.login.yahoo.com%2Fopenid%2Fyrp%2Fsc_check&cancel_url=https%3A%2F%2Fopen.login.yahoo.com%2Fopenid%2Fyrp%2Fsc_check&perms=user_birthday%2Cuser_likes%2Cemail%2Cpublish_actions&response_type=code&locale=en_US

When i try to do this using FB's javascript SDK: FB.ui({ method: 'permissions_request', perms: 'read_stream,publish_stream,user_photos', display: 'iframe' },
function(response){ alert("badfood"); alert(response); });

It goes to a different endpoint: facebook.com/dialog/permissions_request? ...

And I get a 500 server error from facebook without useful debug info.

Thanks

Upvotes: 2

Views: 2651

Answers (2)

Sean Kinsey
Sean Kinsey

Reputation: 38046

Loading the auth/permissions dialogs inside iframes are not permitted nor possible due to the risk of clickjacking. Sites where you see this being done have special agreements with Facebook that allows them to do this.

Upvotes: 0

Chamilyan
Chamilyan

Reputation: 9423

some things.

1) first add the parameter show_error=true. This will tell you more about what's really causing the error.

2) Facebook has multiple ways it can display any dialog. In the fiddler request, note the display=iframe parameter. This is used for canvas applications mainly but can be useful for regular iFrame displays as well. It opens the auth dialog in a lightbox.

3) Try loading the SDK synchronously. Remove the Async references that Facebook tells you to include at the top of the page after the body tag and use the secondary method. Include the all.js and fb-root div tag and load FB.init just before your FB.ui call.

4) Check out the echo tool.

This tool can print out your GET params or your . It can also decode the signed_request parameter as used in Canvas applications with the OAuth 2.0 Beta migration enabled. This is very useful in debugging Canvas Authentication.

http://developers.facebook.com/docs/reference/dialogs/

Upvotes: 1

Related Questions