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
876 B
30 lines
876 B
const Auth0Strategy = require("passport-auth0")
|
|
const passport = require("passport")
|
|
const config = require("../config")
|
|
|
|
//passport-auth0
|
|
const strategy = new Auth0Strategy({
|
|
domain: config.auth0.domain,
|
|
clientID: config.auth0.clientId,
|
|
clientSecret: config.auth0.secret, // Replace this with the client secret for your app
|
|
callbackURL: config.root + "/auth/callback",
|
|
state: true,
|
|
}, (accessToken, refreshToken, extraParams, profile, done) => {
|
|
// accessToken is the token to call Auth0 API (not needed in the most cases)
|
|
// extraParams.id_token has the JSON Web Token
|
|
// profile has all the information from the user
|
|
return done(null, profile);
|
|
}
|
|
)
|
|
|
|
passport.use(strategy)
|
|
|
|
passport.serializeUser(function(user, done) {
|
|
done(null, user);
|
|
});
|
|
|
|
passport.deserializeUser(function(user, done) {
|
|
done(null, user);
|
|
});
|
|
|
|
module.exports = passport
|