authentication.js 679 B

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