- More, more, more...
This commit is contained in:
@@ -5,11 +5,12 @@ const config = require('../../config');
|
||||
const User = require('../../models/user');
|
||||
|
||||
module.exports = function(passport) {
|
||||
passport.use(new FacebookStrategy(
|
||||
|
||||
passport.use('facebook', new FacebookStrategy(
|
||||
{
|
||||
clientID: config.services.facebook.appId,
|
||||
clientSecret: config.services.facebook.appSecret,
|
||||
callbackURL: 'http://localhost:3001/auth/facebook/callback',
|
||||
callbackURL: 'http://localhost:3001/auth/facebook/loggedin',
|
||||
profileFields: ['id', 'email', 'first_name', 'last_name', 'picture'],
|
||||
},
|
||||
(accessToken, refreshToken, profile, done) => {
|
||||
@@ -28,6 +29,7 @@ module.exports = function(passport) {
|
||||
},
|
||||
{
|
||||
accessToken,
|
||||
associatedEmail: email,
|
||||
method: profile.provider,
|
||||
userId,
|
||||
},
|
||||
@@ -43,4 +45,32 @@ module.exports = function(passport) {
|
||||
);
|
||||
}
|
||||
));
|
||||
|
||||
passport.use('facebookLink', new FacebookStrategy(
|
||||
{
|
||||
clientID: config.services.facebook.appId,
|
||||
clientSecret: config.services.facebook.appSecret,
|
||||
callbackURL: 'http://localhost:3001/auth/facebook/linked',
|
||||
profileFields: ['id', 'email', 'first_name', 'last_name', 'picture'],
|
||||
},
|
||||
(accessToken, refreshToken, profile, done) => {
|
||||
const {
|
||||
email,
|
||||
first_name: firstName,
|
||||
id: userId,
|
||||
last_name: lastName,
|
||||
picture: { data: { url = null } = {} } = {},
|
||||
} = profile._json;
|
||||
const avatar = url;
|
||||
|
||||
const strategy = {
|
||||
accessToken,
|
||||
associatedEmail: email,
|
||||
method: profile.provider,
|
||||
userId,
|
||||
};
|
||||
|
||||
return done(null, { avatar, strategy });
|
||||
}
|
||||
));
|
||||
};
|
||||
|
||||
@@ -74,6 +74,7 @@ module.exports = function (passport) {
|
||||
|
||||
return {
|
||||
basic: authenticateBasic(passport),
|
||||
bypass: (req, res, next) => next(),
|
||||
manager: authenticateEventManager(passport),
|
||||
managerOrSelf: authenticateEventManagerOrSelf(passport),
|
||||
passport,
|
||||
|
||||
Reference in New Issue
Block a user