Permalink
Browse files

Added test case

  • Loading branch information...
1 parent 4591c60 commit 7368d81d7d49021c9b34e1b312ed40f982ad72b4 Arthur Taylor committed Mar 25, 2011
Showing with 56 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +19 −0 README
  3. +2 −0 config.js.template
  4. +10 −0 package.json
  5. +23 −0 twitter.js
View
@@ -0,0 +1,2 @@
+config.js
+node_modules
View
19 README
@@ -0,0 +1,19 @@
+Installation:
+==============
+Using nmod for package management:
+
+nmod deps
+
+to install the libraries
+
+
+Configuration:
+=============
+
+Edit config.js.template to include a working Twitter consumer key and secret, move it to config.js
+
+Running:
+========
+node twitter.js
+
+
View
@@ -0,0 +1,2 @@
+exports.key = "test";
+exports.secret = "test";
View
@@ -0,0 +1,10 @@
+{ "name":"auth-test",
+ "description":"Test of connect-auth",
+ "version":"0.0.1",
+ "directories":{"lib":"./lib"},
+ "main":"twitter",
+ "author":{"name":"Arthur Taylor",
+ "email":"arthur@aupeo.com"},
+ "dependencies":{"express":">= 2.1.0","connect":">= 1.1.4","connect-auth":">= 0.2.2","oauth":">= 0.9.0"},
+ "repository":{"type":"git","url":"http://github.com/codders/node-auth-test.git"}
+}
View
@@ -0,0 +1,23 @@
+// enter your twitter api credentials here
+
+var config = require('./config');
+var express = require('express');
+var connect = require('connect');
+var auth= require('connect-auth');
+var app = express.createServer();
+
+app.configure(function(){
+ app.use(connect.cookieParser());
+ app.use(connect.session({ secret: 'foobar' }));
+ app.use(auth( [
+ auth.Twitter({consumerKey: config.key, consumerSecret: config.secret})
+ ]) );
+});
+
+app.get('/', function(req, res){
+ req.authenticate(['twitter'], function(error, authenticated) {
+ res.send('Hello World: ' + JSON.stringify( req.session.auth.user ) );
+ });
+});
+app.listen(8090);
+

0 comments on commit 7368d81

Please sign in to comment.