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.

30 lines
794 B

  1. 'use strict'
  2. /* global wiki */
  3. // ------------------------------------
  4. // Microsoft Account
  5. // ------------------------------------
  6. const WindowsLiveStrategy = require('passport-windowslive').Strategy
  7. module.exports = {
  8. key: 'microsoft',
  9. title: 'Microsoft Account',
  10. props: ['clientId', 'clientSecret', 'callbackURL'],
  11. init (passport, conf) {
  12. passport.use('windowslive',
  13. new WindowsLiveStrategy({
  14. clientID: conf.clientId,
  15. clientSecret: conf.clientSecret,
  16. callbackURL: conf.callbackURL
  17. }, function (accessToken, refreshToken, profile, cb) {
  18. wiki.db.User.processProfile(profile).then((user) => {
  19. return cb(null, user) || true
  20. }).catch((err) => {
  21. return cb(err, null) || true
  22. })
  23. }
  24. ))
  25. }
  26. }