Facebook App dev vol.2 : Creating a Basic App

Note from : Building Facebook Applications with HTML and JavaScript Ch.2

—————- Setting up a web host
–  Need a server, which runs PHP.
** Even if I am only using the Facebook, JavaScript, API, I need to be able to do certain things with PHP

—————- Create server folder structure
** “” = folder name

lynda(root)
|– “-”
| |– ‘css’
| | |–mycss.css
| |– ‘js’
| | |–myscript.js
|– “images”
|– index.php

—————- Checking for registered users

– Find out if a user is logged in to Facebook, and if they have authorized my app.
–> getLoginStatus method of the API

– The Core Methods often you use
FB.api   –> handles access to the social data or social graph
FB.init  –> handles the loading of the Facebook API
FB.ui     –> let you access parts of the Facebook user interfade like dialogs

– Authorization methods Auth Methods
   – FB.getAuthStatus   –> To check to see if a user is logged in
This function is about to control whether you want users to go to your web site and see that page outside of Facebook or do you want them to only have access within Facebook.

How to implement
– add following function code inside FB.init function on myscript.js

FB.getLoginStatus(function(response) {
if (response.status === ‘connected’) {
var uid = response.authResponse.userID;
accessToken = response.authResponse.accessToken;
} else if (response.status === ‘not_authorized’) {
//User is logged into Facebook, but not your App
alert(“User is in Facebook, but not your app”);
}
});

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s