diff options
| author | nanalelfe <nargiza.nosirova@mail.utoronto.ca> | 2016-07-27 01:45:42 +0000 |
|---|---|---|
| committer | nanalelfe <nargiza.nosirova@mail.utoronto.ca> | 2016-07-27 01:45:42 +0000 |
| commit | 3b002a6fb136b9e7e534ffbcfedabed72fcd373d (patch) | |
| tree | d24c3cb1f9e0283de25c32259f692745c6b19bc1 /config | |
| parent | 25706820837bd05cdc3b186eb1d5ebabf9688a61 (diff) | |
Added passport-facbeook
Diffstat (limited to 'config')
| -rw-r--r-- | config/auth.js | 7 | ||||
| -rw-r--r-- | config/passport.js | 16 |
2 files changed, 23 insertions, 0 deletions
diff --git a/config/auth.js b/config/auth.js new file mode 100644 index 0000000..c46c55e --- /dev/null +++ b/config/auth.js @@ -0,0 +1,7 @@ +module.exports = { + 'facebookAuth' : { + 'clientID' : '1618318315164670', + 'clientSecret' : 'b4b67801b2b37f795871ce7cc55a33cf', + 'callbackURL' : 'http://localhost:3000/auth/facebook/callback' + } +}
\ No newline at end of file diff --git a/config/passport.js b/config/passport.js index 38e9397..be8cf10 100644 --- a/config/passport.js +++ b/config/passport.js @@ -1,8 +1,11 @@ var passport = require('passport'); var dbFile = require("../node_simple.js"); var LocalStrategy = require('passport-local').Strategy; +var FacebookStrategy = require('passport-facebook').Strategy; var bcrypt = require('bcrypt-nodejs'); +var configAuth = require('./auth'); + var exports = module.exports = {}; var encryptPassword = exports.encryptPassword = function (password) { @@ -138,3 +141,16 @@ passport.use('local_signin', new LocalStrategy({ } }); })); + +passport.use(new FacebookStrategy({ + clientID: configAuth.facebookAuth.clientID, + clientSecret: configAuth.facebookAuth.clientSecret, + callbackURL: configAuth.facebookAuth.callbackURL + }, + function(accessToken, refreshToken, profile, done) { + User.findOrCreate(..., function(err, user) { + if (err) { return done(err); } + done(null, user); + }); + } +));
\ No newline at end of file |
