Version:
Simple Facebook Integration for NodeJS (and Express)
43 lines (39 loc) • 1.5 kB
HTML
<html>
<head>
<title>Nodogoshi</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="/javascripts/jquery.facebook.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$.fbInit('e1249f7d4bc25b8f90e5c9c7523e3ee1');
// Check whether we're logged in and arrange page accordingly
$.fbIsAuthenticated(function (fbSession) {
// Authenticated!
$.fbProfile(['first_name'], function (profile) {
$('#fb-first_name').html(profile.first_name);
$('.authenticated').show();
});
}, function () {
// Not authenticated
$('.not_authenticated').show();
$('#authenticate').click(function () {
$.fbIframeAuthenticate({'canvas_name': 'nodogoshi'});
return false;
});
});
});
</script>
</head>
<body>
<div id="fb-root"></div>
<script type="text/javascript" src="http://static.ak.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php"></script>
<div id="my-account">
<div class="authenticated" style="display: none">
Hi there <span id="fb-first_name"></span>!
</div>
<div class="not_authenticated" style="display: none">
Viewing anonymously, <a href="#" id="authenticate">click here</a> to authenticate.
</div>
</div>
</body>
</html>