You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
636 B

  1. 'use strict'
  2. /* global wiki */
  3. // ------------------------------------
  4. // Google ID Account
  5. // ------------------------------------
  6. const GoogleStrategy = require('passport-google-oauth20').Strategy
  7. module.exports = (passport, conf) => {
  8. passport.use('google',
  9. new GoogleStrategy({
  10. clientID: conf.clientId,
  11. clientSecret: conf.clientSecret,
  12. callbackURL: conf.callbackURL
  13. }, (accessToken, refreshToken, profile, cb) => {
  14. wiki.db.User.processProfile(profile).then((user) => {
  15. return cb(null, user) || true
  16. }).catch((err) => {
  17. return cb(err, null) || true
  18. })
  19. }
  20. ))
  21. }