Skip to content

Instantly share code, notes, and snippets.

@strada
Created April 22, 2012 08:05
Show Gist options
  • Save strada/2462626 to your computer and use it in GitHub Desktop.
Save strada/2462626 to your computer and use it in GitHub Desktop.
var express = require('express'),
util = require('util'),
helper = require('./helper'),
settings = require('./settings').appSettings,
everyauth = require('everyauth');
everyauth.foursquare
.entryPath('/auth/foursquare')
.callbackPath('/auth/foursquare/callback');
//everyauth.everymodule.moduleTimeout(-1);
everyauth.foursquare
.appId(settings.appId)
.appSecret(settings.appSecret)
.findOrCreateUser( function (session, accessToken, accessTokenExtra, foursquareUserMetadata) {
util.inspect(arguments);
return {};
})
.redirectPath('/');
var app = express.createServer(
express.bodyParser()
, express.static(__dirname + "/public")
, express.favicon()
, express.cookieParser()
, express.session({ secret: '*****'})
, everyauth.middleware()
);
app.get('/', function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('<html><head></head><body><a href="' + helper.getAuthUrl() + '">Connect with Foursquare</a></body></html>');
});
everyauth.helpExpress(app);
app.listen(4040);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment