Skip to content
Advertisement

Node + Passport, Error: Authentication strategies must have a name

I’m trying to initialize a SAML strategy during the require line. Something like this:

JavaScript

but am getting the error:

JavaScript

or TypeError: Cannot read property 'name' of undefined at Authenticator.use if a custom strategy name is not defined: passport.use(myStrat);

.

I’ve had it like this (which works):

JavaScript

but I wish to change it because I need to call passport-saml’s Stragety.generateServiceProviderMetadata() function later on. Which (I think) mean I need a variable pointing to the new Strategy instance. Not a big deal I know, just would like to have the code for this particular strategy look more in line with the rest if I can. Which all look like:

JavaScript

Advertisement

Answer

this should work:

JavaScript

or, if you want to hold the instance:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement