microsoft.js 782 B

1234567891011121314151617181920212223242526272829
  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.users.processProfile(profile).then((user) => {
  19. return cb(null, user) || true
  20. }).catch((err) => {
  21. return cb(err, null) || true
  22. })
  23. }
  24. ))
  25. }
  26. }