-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauth.js
44 lines (36 loc) · 1.08 KB
/
auth.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
var passport = require('passport')
, GoogleStrategy = require('passport-google').Strategy
, TwitterStrategy = require('passport-twitter').Strategy
, config = require('./authConfig');
var Auth = function () {
passport.use(new GoogleStrategy({
returnURL: config.google.returnURL,
realm: config.google.realm
},
function(identifier, profile, done) {
console.log("google identifier: "+identifier);
console.dir(profile);
done(null, profile);
}
));
passport.use(new TwitterStrategy({
consumerKey: config.twitter.consumerKey,
consumerSecret: config.twitter.consumerSecret,
callbackURL: config.twitter.callbackURL
},
function(token,tokenSecret, profile, done) {
console.log("twittr token: "+token);
console.log("twittr token secret: "+tokenSecret);
console.dir(profile);
done(null, profile);
}
));
passport.serializeUser(function(user, done) {
done(null, user);
});
passport.deserializeUser(function(obj, done) {
done(null, obj);
});
return passport;
};
module.exports = Auth;