The frontend/UI server, written in JS using the MarkoJS library
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.

28 lines
860 B

6 years ago
  1. const Auth0Strategy = require("passport-auth0")
  2. const passport = require("passport")
  3. const config = require("../config")
  4. //passport-auth0
  5. const strategy = new Auth0Strategy({
  6. domain: config.auth0.domain,
  7. clientID: config.auth0.clientId,
  8. clientSecret: config.auth0.secret, // Replace this with the client secret for your app
  9. callbackURL: config.root + "/auth/callback"
  10. }, (accessToken, refreshToken, extraParams, profile, done) => {
  11. // accessToken is the token to call Auth0 API (not needed in the most cases)
  12. // extraParams.id_token has the JSON Web Token
  13. // profile has all the information from the user
  14. return done(null, profile);
  15. }
  16. )
  17. passport.use(strategy)
  18. passport.serializeUser(function(user, done) {
  19. done(null, user);
  20. });
  21. passport.deserializeUser(function(user, done) {
  22. done(null, user);
  23. });
  24. module.exports = passport