Facebook App dev vol.3 : Creating a Basic App

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

—————- Using the OAuth dialog

After I check the registration status of a user, I can ask them to log into my application. Authorization can happen in a few ways.

– Application is visible to any user, regardless of whether they’re logged into Facebook or not

– Application is visible to some users and a more enhanced version to users who are logged in

– Anyone who comes into page to log into Facebook

Auth Methods : FB.login
 – FB.login prompts the user to authenticate your application using the OAuth Dialog
FB.login results in the JS SDK attempting to open a popup window.

Usually the browser will block pop-up windows. For that reason FB.login() should be called as result of a click.

Change the code to….

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
FB.login(function(response) {
}, {scope: ’email, user_likes’});

} else {
// User is not logged into Facebook at all
window.top.location = ‘https://www.facebook.com/index.php’;


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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s