microsoft.js 654 B

12345678910111213141516171819202122232425
  1. 'use strict'
  2. /* global wiki */
  3. // ------------------------------------
  4. // Microsoft Account
  5. // ------------------------------------
  6. const WindowsLiveStrategy = require('passport-windowslive').Strategy
  7. module.exports = (passport, conf) => {
  8. passport.use('windowslive',
  9. new WindowsLiveStrategy({
  10. clientID: conf.clientId,
  11. clientSecret: conf.clientSecret,
  12. callbackURL: conf.callbackURL
  13. }, function (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. }