Created
August 29, 2013 19:58
-
-
Save stenehall/6382710 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var passport = require('passport'); | |
var util = require('util'); | |
var GitHubStrategy = require('passport-github').Strategy; | |
passport.serializeUser(function(user, done) { | |
done(null, user); | |
}); | |
passport.deserializeUser(function(obj, done) { | |
done(null, obj); | |
}); | |
passport.use(new GitHubStrategy({ | |
clientID: '...', | |
clientSecret: '...', | |
callbackURL: "http://.../auth/github/callback" | |
}, | |
function(accessToken, refreshToken, profile, done) { | |
process.nextTick(function () { | |
return done(null, profile); | |
}); | |
} | |
)); | |
app.use(express.session({ secret: '...' })); | |
app.use(passport.initialize()); | |
app.use(passport.session()); | |
app.get('/auth/github', | |
passport.authenticate('github'), | |
function(req, res){ | |
// The request will be redirected to GitHub for authentication, so this | |
// function will not be called. | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ [error: invalid input syntax for integer: "auth"] | |
name: 'error', | |
length: 86, | |
severity: 'ERROR', | |
code: '22P02', | |
detail: undefined, | |
hint: undefined, | |
position: undefined, | |
internalPosition: undefined, | |
internalQuery: undefined, | |
where: undefined, | |
file: 'numutils.c', | |
line: '62', | |
routine: 'pg_atoi' } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment