auth0 / passport-windowsauth

Windows Authentication strategy for Passport.js
MIT License
178 stars 54 forks source link

documentation of usage without LDAP seems to be incorrect #31

Open sidorares opened 8 years ago

sidorares commented 8 years ago

Hi,

the example in documentation is

passport.use(function(profile, done){
  User.findOrCreate({ waId: profile.id }, function (err, user) {
    done(err, user);
  });
}));

but passport.use() expects name, strategy arguments ( or alternatively strategy, with strategy.name defined ) and otherwise throws exception

Looks like correct example should look like this:

passport.use(new WindowsStrategy({
  integrated: true
  }, function(profile, done){
    User.findOrCreate({ waId: profile.id }, function (err, user) {
      done(err, user);
    });
}));
cjmyles commented 7 years ago

I was getting the following error when executing the code from the Readme (as per your first example):

"Error: Authentication strategies must have a name"

I solved the issue by providing a name in the passport.use() function, such as:

passport.use('WindowsAuthentication', function(profile, done){

However, I then started receiving a different error:

TypeError: strategy.authenticate is not a function

Following your second example seems to have fixed both errors for me.