Closed LeoMoonStar closed 5 years ago
I somehow find the sample code for configure in this repo is different from that on Passport website. I am just wondering what makes the difference
passport.use(new LocalStrategy(
function(username, password, done) {
User.findOne({ username: username }, function (err, user) {
if (err) { return done(err); }
if (!user) {
passport.use(new DocusignStrategy({
clientID: DOCUSIGN_INTEGRATOR_KEY,
clientSecret: DOCUSIGN_APP_SECRET,
callbackURL: "http://localhost:3000/auth/docusign/callback"
},
function(accessToken, refreshToken, profile, cb) {
User.findOrCreate({ email: profile.email }, function (err, user) {
return cb(err, user);
});
}
));
DocuSign uses OAuth2 standard, which is completely different from the so-called "Basic Authentication" (i.e. username/password) that is implemented by LocalStrategy. Facebook have a similar Passport.js implementation, sinc they also use OAuth2: https://github.com/jaredhanson/passport-facebook#configure-strategy
Hi, I'm working on an updated example that uses async/await, promises, etc. I plan to publish it around week of July 30th. Thank you for your interest!