HTML and CSS Reference
In-Depth Information
<div class="fb-login-button" data-scope="email"></div>
The last piece needed is to create the
channel.html
for browsers that don't support cross-domain com-
munication. Create a directory under your application called
public/
and enter the code in
Listing 20-4
into a
file called
channel.html
in that public directory.
Listing 20-4:
channel.html
<script src="http://connect.facebook.net/en_US/all.js"></script>
As mentioned, this file is required for Internet Explorer and some older browsers, so if it's not set up cor-
rectly, you may not notice until the bug reports start coming in.
Testing the Facebook Authentication
With all the pieces in place, you should now test the Facebook authentication. You can run your Node.js ap-
plication by typing
node web.js
. This starts the server on port 3000. You should now visit the server in your
desktop browser by visiting
http://localhost:3000
.
If everything runs correctly, you should see the title screen and a small Facebook login button that you can
click. Clicking the button pops up an OAuth login screen, as shown in
Figure 20-4
.
Figure 20-4:
Blob Clicker OAuth login.
Clicking on the Log in with Facebook button takes you back to your application, which redirects to the
/game
screen and displays the name from your Facebook account.