|
|
|
|
@ -6,7 +6,8 @@
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
|
|
<button onclick="checkLoginState()">FaceBook Login</button>
|
|
|
|
|
<button id="login" onclick="checkLoginState()">FaceBook Login</button>
|
|
|
|
|
<button id="login_out" onclick="loginOut()">FaceBook Login Out</button>
|
|
|
|
|
<div id="status">
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
@ -36,16 +37,26 @@
|
|
|
|
|
console.log('statusChangeCallback');
|
|
|
|
|
console.log(response);
|
|
|
|
|
if (response.status === 'connected') {
|
|
|
|
|
$("#login").text('Login Out');
|
|
|
|
|
// Logged into your app and Facebook.
|
|
|
|
|
testAPI();
|
|
|
|
|
} else {
|
|
|
|
|
FB.login();
|
|
|
|
|
FB.login(function (response) {
|
|
|
|
|
statusChangeCallback();
|
|
|
|
|
window.history.back();
|
|
|
|
|
}, {scope: 'public_profile,email'});
|
|
|
|
|
// The person is not logged into your app or we are unable to tell.
|
|
|
|
|
document.getElementById('status').innerHTML = 'Please log ' +
|
|
|
|
|
'into this app.';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function loginOut() {
|
|
|
|
|
FB.logout(function (response) {
|
|
|
|
|
// Person is now logged out
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function updateStatusCallback(response) {
|
|
|
|
|
statusChangeCallback(response);
|
|
|
|
|
}
|
|
|
|
|
|