mxstbr / passport-magic-login

Passwordless authentication with magic links for Passport.js.
MIT License
664 stars 45 forks source link

TypeError: MagicLoginStrategy is not a constructor #7

Open qkoots opened 3 years ago

qkoots commented 3 years ago

Hello,

While literally copy pasting your code, I get a error message that the MagicLoginStrategy is not a constructor. Why is this happening?

const magicLogin = new MagicLoginStrategy({
      ....
})

// Add the passport-magic-login strategy to Passport
// passport.use(magicLogin)

Thanks!

alexndr-n commented 2 years ago

Same here, were you able to sort this?

alexndr-n commented 2 years ago

Ok it was const MagicLoginStrategy = require('passport-magic-login').default

naftali100 commented 1 year ago

is there a solution to this without using require?

dweldon commented 1 year ago

If you're using ESM, you can import it like this:

import _MagicLoginStrategy from 'passport-magic-login';
const MagicLoginStrategy = _MagicLoginStrategy.default;

const magicLogin = new MagicLoginStrategy({
  ...
});