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.

26 lines
687 B

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