Facebook getAuthResponse error: OAuth2 support disabled - facebook

I am attempting to use the Facebook getAuthResponse() function and it is returning the following error:
function () {if(!FB._oauth)throw new Error('getAuthResponse called when OAuth2 support is '+'disabled. Please fix.');return FB._authResponse;}
I am using the following for my initial Facebook Auth:
FB.init({ appId: 'xxxxxxxxxxxxxxx",
status: true,
cookie: true,
xfbml: true,
oauth: true
});
And the following code to load the JavaScript SDK:
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
google.maps.event.addDomListener(window, 'load', initialize);
google.maps.event.addListener(map, 'click', initialize);
If anyone could shed any light on what's going on here I'd greatly appreciate it.

As far as I remember this was a setting in https://developers.facebook.com/apps/XXXX/advanced page. Have you checked that?

Related

Facebook scrollTo()

I'm having a very bizzare issue with Facebook's scrollTo(). Here's my relevant code:
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'APPID',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
oauth : true // enable OAuth 2.0
});
FB.Canvas.setSize({ width: 810, height: 5000 });
//FB.Canvas.setAutoGrow();
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
function scrollToQuestion(top) {
FB.Canvas.scrollTo(0, top);
}
</script>
Here's the bizzare issue, the code on it's own does NOT work. HOWEVER while using firebug and putting a breakpoint right on the FB.Canvas.scrollTo(top, 0); line than the functionality works. What's going on...?!
EDIT: Finally figured it out... for some odd reason top variable was coming in as a string of some sort. I had to change the call to the function like this:
var top = 0;
top = parseInt($('.top'"]').position().top);
scrollToQuestion(top);
This fixed my issue.

Apprequests from a Website

Is there any way to send apprequests if your application is a website?
I reported a bug on facebook http://developers.facebook.com/bugs/182553325173000 but I do not know if this is possible or not
yes you can do this by adding the JS API,
before <body> add:
<script type="text/javascript">
function inviteFriends(){
var receiverUserIds = FB.ui({
method : 'apprequests',
message: 'YOUR CUSTOM MESSAGE',
},
function(receiverUserIds) {
console.log("IDS : " + receiverUserIds.request_ids);
}
);
}
</script>
after the <body> include the API (asynchronous method):
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'YOUR APP ID',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true, // parse XFBML
oauth : true //enables OAuth 2.0
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
and call it:
or
You can do that with the Javascript SDK
it is in the documentation:
https://developers.facebook.com/docs/reference/dialogs/requests/
It's possible, as the other answers have shown, but the user will be brought to your canvas app when they accept the requests

FB Async Feed failing on Authentication

The code below has been used for several month successfully. But recently, it stopped working. The objective is to pull the latest feed from a facebook page. The response is now "An access token is required to request this resource." But reading the JS SDK docs never suggest anything more than an app ID for this method. What is the real error here?
<script type="text/javascript">
window.fbAsyncInit = function() {
FB.init({appId: '<?php echo $this->appId; ?>', status: true, cookie: true, xfbml: true});
FB.api('/<?php echo $this->appId; ?>/feed', {'limit': <?php echo (int)$this->feedLimit; ?>}, function(response) {
if(response.data[0]) {
jQuery('.facebook .comment p a').append(response.data[0].message);
}
});
};
(function() {
var e = document.createElement('script');
e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
Ah, that should work (if your app ID is indeed correct): did the app ID somehow change to a user ID in the recent past?
EDIT: ah, must be a recent change in the platform. I'm guessing accessing app feeds now need a token. See http://developers.facebook.com/blog/post/510/ for details.

facebook fb:login-button for mobile web

I'm trying to fb:login-button work for mobile web, a la: http://developers.facebook.com/docs/guides/mobile/
However, I'm not sure where to add this code: &display=touch
My FBML is the standard:
<fb:login-button autologoutlink='true' perms='user_about_me,email'></fb:login-button>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({ appId: 'XXXXXXX', status: true, cookie: true, xfbml: true });
FB.Event.subscribe('auth.login', function() {
location.href = "....";
});
};
(function() {
var e = document.createElement('script');
e.type = 'text/javascript';
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
} ());
</script>
Any ideas?
I'm pretty certain you're not able to use the FBML tags for mobile web applications. At least, they won't accept the display=touch argument.
It means you'll need to use the slightly more complex OAuth implementation that they describe on http://developers.facebook.com/docs/guides/mobile/
It kinda makes sense if you think about it. The FBML tags generally rely on popups or overlays, which you can't really be certain will be compatible with all mobile browsers. The OAuth implementation takes you off to a FB page and returns you back to your host site for authentication and authorisation.

integrated facebook facepile need

I am working on project, it needs facepile (plugin of facebook) in index page,
how can I do it?
you need to get an appID from facebook developers site. (http://developers.facebook.com/setup/)
then..
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId: 'YOUR APP ID HERE', status: true, cookie: true,
xfbml: true});
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
'//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
THEN...
place this into your page:
<fb:friendpile width="210"></fb:friendpile>
or whatever feature you need.
try this link for more: http://developers.facebook.com/docs/reference/javascript/
Is this showing the Facepile of a page or the user himself (me)?
I tried your code but it always shows a login frame also if I'm already logged in to Facebook.
My target is to have a list of Fans and posts of a specific page for my website.