Skip to content

Instantly share code, notes, and snippets.

@pradeepkumargali
Last active October 17, 2017 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pradeepkumargali/4dba793fc2eab9bf39883bebe3ee4f0e to your computer and use it in GitHub Desktop.
Save pradeepkumargali/4dba793fc2eab9bf39883bebe3ee4f0e to your computer and use it in GitHub Desktop.
ODIC Strategy Azure AD
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