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.

29 lines
876 B

6 years ago
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. state: true,
  11. }, (accessToken, refreshToken, extraParams, profile, done) => {
  12. // accessToken is the token to call Auth0 API (not needed in the most cases)
  13. // extraParams.id_token has the JSON Web Token
  14. // profile has all the information from the user
  15. return done(null, profile);
  16. }
  17. )
  18. passport.use(strategy)
  19. passport.serializeUser(function(user, done) {
  20. done(null, user);
  21. });
  22. passport.deserializeUser(function(user, done) {
  23. done(null, user);
  24. });
  25. module.exports = passport