Skip to content

Instantly share code, notes, and snippets.

@chanon
chanon / gist:661597
Created November 3, 2010 19:50
Facebook iframe Canvas App Authentication in node.js
var querystring = require("querystring");
var base64ToString = function(str) {
return (new Buffer(str || "", "base64")).toString("ascii");
};
var base64UrlToString = function(str) {
return base64ToString( base64UrlToBase64(str) );
};
@frostbytten
frostbytten / server.js
Created June 12, 2011 11:04
Connect-Auth Facebook Example
// Example taken from https://github.com/ciaranj/connect-auth/issues/45
var fbId= "xxxxxxxxxxxxx";
var fbSecret= "xxxxxxxxxxxxxx";
var fbCallbackAddress= "http://localhost:3000/auth/facebook_callback"
var cookieSecret = "node"; // enter a random hash for security
var express= require('express');
var auth = require('connect-auth')
@fwielstra
fwielstra / api.js
Created June 14, 2011 14:46
An example NodeJS / Mongoose / Express application based on their respective tutorials
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');