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.

30 lines
777 B

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