I have a facebook application that is a tab inside a fan page.
I have used the signed request to see if a user likes the page and show content based on that.
I have also managed to use get the facebook user id after prompting the user to log in and grant access to the application.
What I CAN'T do, is get the 'apprequests' functionality to work. I have tried it a couple of ways:
FYI - am using this version of jquery: https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<form id="form1" runat="server">
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({ appId: 'myappid', xfbml: true, cookie: true, oauth: true });
};
function inviteFriends() {
FB.ui({
method: 'apprequests',
message: 'Enter this cool competition http://www.facebook.com/pages/My-Test-Fan-Page/204123762998981?sk=app_308637695832192',
redirect_uri: 'http://www.facebook.com/pages/My-Test-Fan-Page/204123762998981?sk=app_308637695832192',
display: 'iframe'
},
function (response) {
console.log(response);
}
);
}
....
when I do this, there are 2 issues (and I think they're probably related) 1. The request isn't sent to the selected users 2. The function for the response isn't called. When I call the FB.ui method, I can selected users, but when I do that, the dialog shows a loading screen and just shuts down.
One thing that I found strange was that when I didn't include the 'redirect_uri' parameter (which from what I can see should not be necessary), I got an error saying the application did not own the call back url.
I have also tried doing it this way
var message = 'Enter this cool competition';
var requestUrl = 'http://www.facebook.com/dialog/apprequests?app_id=308637695832192&redirect_uri=http://localhost:51934/Default.aspx&message=' + message;
window.top.location.href = requestUrl;
This also appears to work, I can select users and it appears to work - I get the users that I added in the to[0], to[1], etc query string paramaeters.
Is there anything I'm doing that's wrong and could be causing this? When I request the user to authorize the app, I'm just requesting standard access, as far as I can tell from the Facebook docs this is all that should be required. I'm also wandering if there's some limitations on what can be done inside a page ta?
Any help would be greatly appreciated.