Everyauth support for Facebook Canvas App with Node.js

I’m working on a Facebook version of my online debates app, http://gruff.co. It’s written in Node.js and uses everyauth for authentication support. Unfortunately, it doesn’t appear to offer support for Facebook canvas apps; only for authenticating via Facebook within your own site.

I just created a fork of everyauth and added rudimentary support, so if, like me, you’ve been desperately combing the net for a solution, give it a try!

1) Add the following configs to your everyauth.facebook statements:

.canvasPath(‘/auth/facebook/canvas’)
.canvasPage(‘http://apps.facebook.com/[your-app-name]’)

Make sure you also have specified ‘myHostname’ and ‘fields’

2) Remove your old version of everyauth

3) Change your package.json to point at my tarball version:

“everyauth”: “https://github.com/bigokro/everyauth/raw/master/everyauth.tar.gz“,

4) Run “npm install” – it should download, unpack and install my version of everyauth

5) Make sure your findOrCreateUser() knows how to look up/save the user via the oauth user data that is supplied by Facebook via the canvas page post (you should probably print out the values just to test, or look at the Chrome dev console/firebug reports.

That should do it! Note that there are a lot of TODOs in there, like passing on any querystring params that are sent to the canvas page, and verifying the signature from Facebook. I’ll probably need to do those before this can actually be added to the project, but I have already sent a pull request to get it into the official version.

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

%d bloggers like this: