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.

29 lines
780 B

  1. /* global WIKI */
  2. // ------------------------------------
  3. // Okta Account
  4. // ------------------------------------
  5. const OktaStrategy = require('passport-okta-oauth').Strategy
  6. module.exports = {
  7. init (passport, conf) {
  8. passport.use('okta',
  9. new OktaStrategy({
  10. audience: conf.audience,
  11. clientID: conf.clientId,
  12. clientSecret: conf.clientSecret,
  13. idp: conf.idp,
  14. callbackURL: conf.callbackURL,
  15. response_type: 'code',
  16. scope: ['openid', 'email', 'profile']
  17. }, (accessToken, refreshToken, profile, cb) => {
  18. WIKI.models.users.processProfile(profile).then((user) => {
  19. return cb(null, user) || true
  20. }).catch((err) => {
  21. return cb(err, null) || true
  22. })
  23. })
  24. )
  25. }
  26. }