Last active
October 17, 2017 09:16
-
-
Save pradeepkumargali/4dba793fc2eab9bf39883bebe3ee4f0e to your computer and use it in GitHub Desktop.
ODIC Strategy Azure AD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
passport.use(new Strategy({ | |
domain: process.env.AUTH0_DOMAIN, | |
clientID: process.env.AUTH0_CLIENT_ID, | |
clientSecret: process.env.AUTH0_CLIENT_SECRET, | |
callbackURL: process.env.AUTH0_CALLBACK_URL, | |
passReqToCallback: true | |
}, | |
function(req, issuer, audience, profile, accessToken, refreshToken, params, cb) { | |
console.log('issuer',issuer); // https://your-domain.auth0.com/ | |
console.log('audience',audience); // user's id. i.e: auth0|5633afe0794d1c5a0b72a2be | |
console.log('accessToken',accessToken); // QSs...emeU | |
console.log('refreshToken',refreshToken); // gAUqAgTPr...dOquQxQ | |
console.log('params',params); // { access_token: 'QSs...meU', | |
// id_token: 'eyJ0eXAi...t7j-e_0', | |
// token_type: 'Bearer' } | |
// | |
//SAVE PARAMERTERS IN SESSION AS NEEDED | |
// | |
req.session.id_token = params.access_token; | |
//not interested in passport profile normalization, | |
//just the Auth0's original profile that is inside the _json field | |
return cb(null, profile._json); | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment