/
password.js
35 lines (26 loc) · 943 Bytes
/
password.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
// Facebook login authorization management
// load all the things we need
var FacebookStrategy = require('passport-facebook').Strategy;
// load the auth variables
var auth = require('./auth'); // use this one for testing
module.exports = function(passport) {
// used to serialize the user for the session
passport.serializeUser(function(user, done) {
done(null, user);
});
passport.deserializeUser(function(user, done) {
done(null, user);
});
//FACEBOOK
passport.use(new FacebookStrategy({
clientID: auth.FACEBOOK_APP_ID,
clientSecret: auth.FACEBOOK_APP_SECRET,
callbackURL: auth.FACEBOOK_CALLBACK_URL
},
function(accessToken, refreshToken, profile, done) {
//This is not what you want to do here.
//Here you should search the connected DB if the user exists and load that in, or add it to db.
done(null, profile);
}
));
};