Facebook Applications Teppo Räisänen
Facebook Applications Facebook provides many Software Development Kits (SDK’s) – PHP SDK – iOS SDK – Android SDK – JavaScript SDK
Facebook Applications Because school server does not support the newest PHP SDK we will use JavaScript SDK – JavaScript SDK provides a rich set of functionality for accessing Facebook’s API – Allow us to render XFBML versions of Social plugins – Invite friends, post to wall etc.
Facebook Applications You load the SDK using the standard element and calling FB.init -function – You must specify a element named fb-root within the document as well.
Facebook Applications FB.init({ appId : 'YOUR APP ID', status : true, // check login status cookie : true, // enable cookies xfbml : true, // parse XFBML channelURL : ' oauth : true // enable OAuth 2.0 });
Facebook Applications Channel.html must contain only one line: This helps with few known bugs
Facebook Applications The first step is figuring out how you identify who the current user is, and how to make API calls on their behalf – FB.login() -- login and/or request extended permissions FB.login() – FB.logout() -- logout (only if the user is connected with your application) FB.logout() – FB.getLoginStatus() -- get current login status from facebook.com FB.getLoginStatus() – FB.getSession() -- synchronous accessor for the current session FB.getSession() See t/ for more info t/
Facebook Applications API calls can be made with FB.api –function: FB.api('/me', function(response) { alert(response.name); }); Makes a popup window displaying user’s name See ascript/FB.api/ for more info ascript/FB.api/
Facebook Applications API calls can be made with FB.api –function: FB.api('/me', function(response) { alert(response.name); }); Makes a popup window displaying user’s name See ascript/FB.api/ for more info ascript/FB.api/
Facebook Applications See Source code p.zip