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.

29 lines
781 B

  1. /* global WIKI */
  2. // ------------------------------------
  3. // Microsoft Account
  4. // ------------------------------------
  5. const WindowsLiveStrategy = require('passport-windowslive').Strategy
  6. module.exports = {
  7. key: 'microsoft',
  8. title: 'Microsoft Account',
  9. useForm: false,
  10. props: ['clientId', 'clientSecret'],
  11. init (passport, conf) {
  12. passport.use('microsoft',
  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. }