Open neilrackett opened 1 year ago
I'd love to have that possibility too. Any chance you found a solution for this?
@adrianbienias I've implemented a solution to this by adding a new create
method to the MagicLoginStrategy
class that returns the same href
and code
values that are currently passed to your custom sendMagicLink
method, for example:
const { href, code } = magicLogin.create('my.email@foo.com');
console.log(`Magic link is ${href} and verification code is ${code}`);
I've created a pull request, but in the meantime you're welcome to use my fork:
npm i github:neilrackett/passport-magic-login
@neilrackett, thanks for sharing your solution.
I've also ended up with crafting custom solution (ultimately even using total own implementation instead of passport-magic-login
).
Thank you for your great work on this strategy!
Is there an existing way to send or generate a magic link using just JavaScript, without needing to do it via a POST/GET call (which the current
send()
method is specifically designed to do)?It would be great to be able to send or generate magic links from within a custom API endpoint, for example:
magicLogin.send('foo@bar.com')
to send an email notification to a user telling them that a document is available that included a magic link that takes them straight to it; ormagicLogin.getMagicLink('foo@bar.com')
to generate a magic link URL to be used elsewhere