Facebook JS SDK - Request UI - facebook

I am trying to create a Facebook Request Dialog with JS SDK inside a Facebook page iframe tab. The dialog shows up, I can select people from my friends, I get no error not even after I click "Send Request", but my friends don`t receive the notification. This is my code:
FB.ui(
{
method: 'apprequests',
message: 'request'
}, function(response) {
console.log(response);
});
LATER EDIT: I uploaded a file with exactly their code from documentation on this tab: http://www.facebook.com/pages/WebTest/255282254520859?sk=app_230016043737427 , and my friends still can`t see the requests.

Have you run it with a Firebug / Chrome console open? Maybe an exception is being generated and dumped there.

Related

Facebook Open Graph - Share Dialog not appearing from Facebook Application

Implementing Share feature on web application.
While the code below works with your favorite desktop and mobile browsers (Share Dialog shows up when clicking on the Share button), it wont work (the Share Dialog doesn't show up) when the web application is opened via Facebook Android Application (by clicking the Website URL from a post and it open's up from the website)
FB.ui({
method: "share_open_graph",
action_type: "og.shares",
action_properties: JSON.stringify({
object: {
"fb:app_id": "my_app_id",
"og:url": "url_of_my_app",
"og:title": "my_app_title",
"og:description": "my_app_desc",
"og:image": "display_image",
"og:image:width": "600",
"og:image:height": "350"
}
})
}, function (response) {});
Rule of thumb when using FB.ui is to not use FB.ui inside a Promise success callback. Facebook Application is blocking pop-ups when called inside a successful return of Promise.

Unable to fetch user using Facebook js sdk v2.10 on Firefox

I am trying to add facebook authentication on our website using Facebook Javascript SDK v2.10. My aim is to login via Facebook and then fetch the user which was authenticated.
The problem I am facing is that on Firefox, I am unable to fetch the authenticated user.
I have created a test page HERE
When you click on the button 'Login via Facebook', the FB.login function is called. When the response is received, I am calling the FB.api function. Following is my code
FB.login(function(response) {
let p1 = document.createElement('p');
p1.innerHTML = "FB.login response follows:<br>"+ JSON.stringify(response);
document.body.appendChild(p1)
FB.api('/me', {fields: 'id,first_name'},
function(response) {
let p2 = document.createElement('p');
p2.innerHTML = "FB.api response follows:<br>"+ JSON.stringify(response);
document.body.appendChild(p2)
});
});
In Chrome,the callback of FB.api is called and the response is received,but, in Firefox, this is not happening. Kindly help me figure out why this is happening
Ok. I was using Facebook sdk in Polymer app. The sdk documentation suggests adding the sdk initialization code in index.html.
But, for Polymer, you need to add the code in the connectedCallback method of your root app (my-app.html if you are using polymer-starter-kit)
For reasons unknown, the webcomponent-loader.js blocks Facebook initialization on Firefox, if sdk code is added in index.html.

Facebook Feed Dialog does not work on Chrome/Android native app

I am developing a Facebook Canvas App which allows user to post a link to their wall:
function postFeed(){
FB.ui({
method: 'feed',
link: 'https://apps.facebook.com/?????',
name: '?????',
description : '?????',
picture: '?????',
}, function(response){});
}
It works fine on desktop (all browsers including desktop Chrome) and mobile Firefox. However when I use mobile Chrome or Android Facebook App's internal browser to open it, the following message shows up when I run postFeed() and be redirected to the feed dialog:
An error occured. Please try again later.
API Error Code: 110
API Error Description: Invalid user id
Error Message: Missing user cookie (to validate session user)
postFeed() is called after I run the following code:
FB.login(function(response) {
if (response.authResponse) {
alert("Welcome!");
}
}, {scope: 'public_profile'});
However if I remove the above code, the error message disappears and I can see the feed dialog normally.
Is there any possible reasons/solution that can solve the problem but without removing the above code?
Thank you very much.
I use 'share' instead of 'feed' method and the problem is gone.

FB.UI apprequests inside a frame causes script access denied error

I am working on an application, which is iframed into another application (different domain). My application which is in the iframe has apprequest functionality implemented. For some reason, whenever I invoke the apprequest dialog, I get a script access denied error.
The following are all the details:
App A --> is in domainA
App B --> is in domainB and is Iframed in to App A.
App B has a button which invokes, the following code:
FB.login(function (resp) {
FB.ui({
method: 'apprequests',
message: msg,
display: 'iframe',
access_token: resp.authResponse.accessToken
}, fbRequestCallback);
});
This throws an error. Please help.
If a user clicks 'Accept' on a Request, they will be sent to the Canvas Page URL of the app that sent the Request. So the request will always be sent back to App that generated the request. You will then have to read the request at:
https://apps.facebook.com/[app_name]/?request_ids=[request_ids]
and redirect it accordingly.

Mobile AppRequests dialog only loading for developer

I am creating a mobile web app, and the friend request dialog works perfectly for me. But when my friend tries to do the app request, the dialog page starts, but gets stuck on loading and never works. Updated info - This only happens on mobile - tested the iphone and safari (with iphone user agent)...when tested in a website browser it works good for my friend.
Here is the code I used, and I am not getting any errors - it just hangs:
function sendRequest() {
FB.ui({
method: 'apprequests',
message: 'invites you to share real-time availability',
},
function(response) {
console.log('sendRequest response: ', response);
});
}
Has anyone else seen this issue? Appreciate any help!
Thanks,
Renee
From the above code, it appears you're missing the init(), login(), getLoginStatus() calls for the second user. It works with you because you may have already granted access to your app.
See:
https://developers.facebook.com/docs/reference/javascript/
and
https://developers.facebook.com/docs/reference/javascript/FB.getLoginStatus/