slack.js 758 B

1234567891011121314151617181920212223242526272829303132
  1. /* global WIKI */
  2. // ------------------------------------
  3. // Slack Account
  4. // ------------------------------------
  5. const SlackStrategy = require('passport-slack').Strategy
  6. module.exports = {
  7. key: 'slack',
  8. title: 'Slack',
  9. useForm: false,
  10. props: {
  11. clientId: String,
  12. clientSecret: String
  13. },
  14. init (passport, conf) {
  15. passport.use('slack',
  16. new SlackStrategy({
  17. clientID: conf.clientId,
  18. clientSecret: conf.clientSecret,
  19. callbackURL: conf.callbackURL
  20. }, (accessToken, refreshToken, profile, cb) => {
  21. WIKI.db.users.processProfile(profile).then((user) => {
  22. return cb(null, user) || true
  23. }).catch((err) => {
  24. return cb(err, null) || true
  25. })
  26. }
  27. ))
  28. }
  29. }