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/
Related
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.
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.
I created an Android App with PhoneGap:Build and the FB Connect Plugin. The app works fine and the FB Plugin, too. Just one tiny thing isn't working yet. I won't to post something after submiting a button which works, too. At the first time the user has to login and grant permissions to the FB App and them the post is published. That's the way it should be. And the next time the user submits the post should be published without the whole permission thing but this isn't working!? FB shows a message like "You already granted permission ... to the app." and the user has to push the Ok-button before the post is published???
Because I still haven't found an answer for my question, maybe I just do something wrong in my FB Javascript call? Here is the current code:
FB.login(function(response) {
if (response.authResponse) {
var data = {
...
}
FB.api('/me/feed', 'post', data, function(response) {
// Callback
if (!response || response.error) {
// ERROR
}
});
} else {
// ERROR
}
}, {scope: 'publish_stream'});
Well, to better understanding here a picture of the screen that apears every post:
http://i.stack.imgur.com/bZrde.png
Thx,
Daniel
I think the solution to this problem is to not include the login request every time you want to post something. You can check login status, and/or permissions, without performing a login. Then, if the user is not logged in, do the login first, and come back to the new post action.
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.
I have created a facebook app which, after clicking a submit button, asks the user for permissions. If the permissions are given, the user is redirected. This works fine in every browser I tested, except for Opera. Opera just doesn't seem to enter the callback function:
$("#perms").click(function(){
FB.ui( { method: 'oauth' } ,
function(response){
alert('test');
if (response != false) {
res = eval('(' + response.session + ')')
}
}
);
});
In Opera, I am asked for permissions, but the alert never happens. Am I doing something wrong? Is there a different (newer) way to ask for permissions that works with Opera? I googled this problem but found only one page with a sort of similar problem. Adding the channel.html didn't solve the problem though.
Thanks in advance
Still see this issue on Opera 11.52.
browser.js enabled and updated to the latest version.
channelURL set as described in FB docs.
But! it works if I use gistfile.js (beautified version of all.js) located on my host
Do you have browser.js enabled? We have workarounds against some problems with Facebook's Connect script. Note that the workarounds will only trigger if you run Facebook's script from the "official" location on Facebook's server.
For background, please see my response on FB.login callback not working on Opera Mobile browser