passport-magic-login icon indicating copy to clipboard operation
passport-magic-login copied to clipboard

TypeError: MagicLoginStrategy is not a constructor

Open qkoots opened this issue 3 years ago • 4 comments

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!

qkoots avatar Apr 14 '21 12:04 qkoots

Same here, were you able to sort this?

alexndr-n avatar Feb 18 '22 17:02 alexndr-n

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

alexndr-n avatar Feb 18 '22 18:02 alexndr-n

is there a solution to this without using require?

naftali100 avatar Feb 27 '23 01:02 naftali100

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({
  ...
});

dweldon avatar Jul 03 '23 03:07 dweldon