passport.use( new GoogleStrategy( { clientID: authConfig.google.client_id, clientSecret: authConfig.google.client_secret, callbackURL: `${schnack_host}/auth/google/callback` }, (accessToken, refreshToken, profile, done) => { done(null, profile); } ) );
passport.use(new GoogleStrategy({ clientID: process.env.GOOGLE_AUTH_CLIENT_ID, clientSecret: process.env.GOOGLE_AUTH_CLIENT_SECRET, callbackURL: `${authURL}/auth/google/callback` }, (accessToken, refreshToken, profile, cb) => { if (profile.emails && profile.emails.find(e => e.value.match(new RegExp(`@${process.env.GOOGLE_AUTH_DOMAIN}$`)) && e.verified)) { return cb(null, profile); } return cb(`${profile.emails && profile.emails[0] && profile.emails[0].value} not within @${process.env.GOOGLE_AUTH_DOMAIN}`); }));
passport.use( new TwitterStrategy( { consumerKey: authConfig.twitter.consumer_key, consumerSecret: authConfig.twitter.consumer_secret, callbackURL: `${schnack_host}/auth/twitter/callback` }, (token, tokenSecret, profile, done) => { done(null, profile); } ) );
passport.use(new LocalStrategy( function(username, password, done) { User.findOne({ username: new RegExp(username, 'i'), socialId: null }, function(err, user) { passport.use(new FacebookStrategy(config.facebook, verifySocialAccount)); passport.use(new TwitterStrategy(config.twitter, verifySocialAccount));
const mastodonAuth = ({ domain, client_id, client_secret }) => { passport.use( new MastodonStrategy(
passport.use( new TwitterStrategy(
passport.use( new GoogleStrategy(
passport.use( new GitHubStrategy( { clientID: authConfig.github.client_id, clientSecret: authConfig.github.client_secret, callbackURL: `${schnack_host}/auth/github/callback` }, (accessToken, refreshToken, profile, done) => { done(null, profile); } ) );
passport.use( new FacebookStrategy( { clientID: authConfig.facebook.client_id, clientSecret: authConfig.facebook.client_secret, callbackURL: `${schnack_host}/auth/facebook/callback` }, (accessToken, refreshToken, profile, done) => { done(null, profile); } ) );