I want to open a facebook dialog in an iframe, instead of as a popup - facebook

The following code generates a link that when clicked will popup a facebook dialog, and once the user authenticates to facebook, they can share to their wall.
<a href="http://www.facebook.com/dialog/feed?app_id=<APP_ID>&message=<MESSAGE>&caption= <CAPTION>&link=<LINK>&display=popup&redirect_uri=<REDIRECT>" class="share-icon facebook popup" rel='Share via Facebook'></a>
I would like for the same dialog to be generated within my page using an iframe. I attempted to load it like this:
<iframe src="http://www.facebook.com/dialog/feed?app_id=<APP_ID>&message=<MESSAGE>&display=iframe&access_token=ACCESS_TOKEN&redirect_uri=<REDIRECT>&show_error=true&caption=<CAPTION>&link=<LINK>"/>
The popup works fine. But, when I try the Iframe, it loads the following error:
API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: redirect_uri is not owned by the application.
Which of course seems wrong, because it's the same redirect_uri in both links.
The end result I want, is the share to be in page, and not be a popup. Any suggestions?

In the app settings (specifically Settings -> Basic -> Basic Info), is the domain of the redirect_uri specified in the "App Domain" field? In general, I get that error when I fail to do that.
(And as to why that might be happening, Facebook treats iframes much more strictly than new windows.)

Related

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
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/
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.

Facebook Like Box not working for Facebook profile URL

I've found that the Like Box app for Facebook will not recognise certain pages and profiles. I thought it might have a been a privacy issue buts its not. As it shows pages I have no affiliation with fine enough. But My own personal page and my clients page will show.
clients page is www.facebook.com/scottish.p.drumming
All I see is this error message:
There was an error fetching the like box for the specified page.
Igy is right, the like box can only be used on a facebook page and not on a facebook user profile.
One option would be to convert your user profile to a facebook page. This can be done following the steps on the link below:
https://www.facebook.com/help/?faq=116067818477568#How-do-I-convert-my-personal-account-to-a-Facebook-Page?
When this is in place you can then visit the plugins page and get the code needed for your like box

Facebook denies access of my app

I have an app that shows the share popup.
I have encountered a problem when trying to get it working form a different server.
I get the following error:
Error An error occurred with myapp. Please try again later.
API Error Code: 191 API Error Description: The specified URL is not
owned by the application
Error Message: redirect_uri is not owned by
the application.
How can I enable it to work from all servers? no matter if they are mine or not?
Any suggestions?
Thanks in advance.
Note:
I would like it to be via the JS SDK.
Facebook apps can only work with one main domain.
The main domain is derived from either the "Site url" or the "Mobile web url" as defined in the app settings page in the Developers application.
You can however add subdomains for that same domain.
For example, let's say your "Site url" is http://app.example.com, you can add more subdomains which you want to use with facebook by adding them to the "App Domains" field in the settings page (basic tab).
You can add subdomains like: http://sub1.example.com or http://example.com.
If you try to add a url that does not derive from that you should get the following error message when trying to save the settings:
Error
DOMAIN_YOU_ADDED must be derived from your Site URL or your Mobile Web
URL.
Edit
You have a problem if you want to use the FB.ui method.
The fb sdk will only accept usage from your own domain, and if you load an iframe from your own domain then the parent window (which is of another domain) won't be able to communicate with that iframe (same origin policy).
What you should be able to do is use the direct url of the feed dialog:
http://www.facebook.com/dialog/feed?
app_id=123050457758183&
link=http://developers.facebook.com/docs/reference/dialogs/&
picture=http://fbrell.com/f8.jpg&
name=Facebook%20Dialogs&
caption=Reference%20Documentation&
description=Using%20Dialogs%20to%20interact%20with%20users.&
redirect_uri=http://www.example.com/response
You can open that in a new window/tab, or if it's an action of a user click then even open a pop-up.
But you won't be able to use the iframe dialog of the sdk.

Feed dialog to event/fan page says "Sorry, something went wrong." after clicking share

Having some issues with the feed dialog when attempting to post to a event or fan page. In my application I am using the JS API and FB.ui using the method feed.
But for a demonstration you can do it using the feed url too for example:
http://www.facebook.com/dialog/feed?app_id=131727613511269&to=287203454659917&redirect_uri=http://www.timeanddate.com/
After clicking share you get the:
Sorry, something went wrong.
We're working on getting this fixed as soon as we can.
Where:
app_id = your app
to = a event / fan page
redirect_uri = a url you are allowed to redirect to
note that the app has publish_stream permissions. (it also has manage_pages for fan pages)
The app in question by the way is: http://apps.facebook.com/tndcountdown/
Thanks,
Andy
EDIT:
An Example taken straight from the documentation:
http://www.facebook.com/dialog/feed?app_id=123050457758183&link=http://developers.facebook.com/docs/reference/dialogs/&picture=http://fbrell.com/f8.jpg&name=Facebook%20Dialogs&caption=Reference%20Documentation&description=Using%20Dialogs%20to%20interact%20with%20users.&message=Facebook%20Dialogs%20are%20so%20easy!&redirect_uri=http://www.example.com/response&to=287203454659917
just replace to=287203454659917 with an event.. (make a test one like it did there)
A few issues I've run into will dialog is that Facebook tries to fill in any missing data. So if you don't provide a description and caption, Facebook will try to scrape the page to get that content. Depending on how the page responds to the "scraping" Facebook will error out. I always make sure I include at least a space for those fields.
It seems the feed url you provided is similar to what is in the documentation. But the demo in the documentation has extra parameters.
I'm about to add page support to my Facebook app, which does the same thing as yours.
http://apps.facebook.com/countdown-timer/
As I posted here - Facebook Send Button - 'Sorry, something went wrong.'...
I had the same problem & worked out that this was due to linking to a Facebook page that did not have a vanity URL set up (i.e. http://www.facebook.com/CubicMushroom rather than http://www.facebook.com/profile.php?id=261963707177053). If you set up a vanity URL for the page it seems to work OK (providing you link to the vanity URL version of the page URL).
To claim a vanity URL, once you have a certain no of like (it used to be 25, but think it's a little lower now) visit https://www.facebook.com/username/

API Error Code 191 when adding page tabs

I'm aware this is a very frequently asked question but I'm really new to this whole app development thing.
I am the admin of a facebook page and I want to add a tab to the side of the page. So I followed facebook's instructions and created the page tab, but when I tried to access the "add to page" dialog box, I got API Error Code 191:
API Error Description: The specified URL is not owned by the application
Error Message: redirect_uri is not owned by the application.
The URL I was using for the box to appear was: https://www.facebook.com/dialog/pagetab?app_id=317467938291427&display=popup&next=https://www.facebook.com/287sqnatc/contact
(The contact at the end is the URL for the app I wish to add.)
Where have I gone wrong, and can someone explain it in simple 5-year-old terms?
next (or redirect_uri) parameter you pass to Add Page Tab Dialog should contain either URL owned by your application or special URL https://www.facebook.com/connect/login_success.html (intended to be used in desktop applications).
You can use FB.ui method of JS-SDK with method pagetab as shown in example of Add Page Tab Dialog documentation this will automatically provide redirect_uri for dialog and allow user to add page tab without leaving your application.