Skip to content

Instantly share code, notes, and snippets.

@lawwantsin
Created June 6, 2011 04:31
Show Gist options
  • Save lawwantsin/1009749 to your computer and use it in GitHub Desktop.
Save lawwantsin/1009749 to your computer and use it in GitHub Desktop.
Fix for Neosmart's fbWall JQuery Plugin.
/*
Fix for Neosmart's fbWall JQuery Plugin.
http://www.neosmart.de/social-media/facebook-wall
after facebook required an access token. Stated here.
http://developers.facebook.com/blog/post/510
Hope everyone at home can follow along.
*/
// Using the Javascript SDK, you get login status. Works with FB.login() this same way.
FB.getLoginStatus(
function(response) {
// if they're logged in and connected to your app.
if (response.status == 'connected') {
// save the access_token somewhere. I choose the #fb-root div.
var access_token = response.session.access_token;
$('#fb-root').data('access_token', access_token);
}
}
});
/*
Then, in the plugin file. jquery.neosmart.fb.wall.js Version 1.2.6
Pull the token from where you saved it. Change the ajax url option to add access_token as another parameter.
*/
var access_token = $('#fb-root').data('access_token');
$.ajax({
url: graphURL+o.id+"/"+type+"?limit="+o.max+"&access_token="+access_token, // Line 62.
dataType: "jsonp",
success:function (data, textStatus, XMLHttpRequest) {
meta.removeClass('loading');
initWall(data);
}
});
/*
If they'd had used the Javascript SDK in the plugin, it wouldn't have broken,
but then the plugin would be forever tied to the SDK. It's a judgement call the authors had to make.
I like facebook's Javascript SDK as a rule. Very helpful when you're just learning OAuth.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment