Auth0 Home Blog Docs

Passworless Authentication in Node

authentication-api
auth0
api
login

#1

Good day! I’m trying to implement a Passwordless login using auth0 node package. Basically I’m trying to send magic link through email without getting the email value in the browser, so I’m getting the email from an API.

Note: The email that has been pulled from other API is already registered in Auth0

The problem was when I receive the link in my Inbox and click it, I’m getting the Opt-in that I should allow the app to access the profile, which is not the path that I’m expected to see. So here’s my code:

const AuthenticationClient = require('auth0').AuthenticationClient

app.get('/sendmagiclink', function(req, res) {
    let auth0 = new AuthenticationClient({
        domain: [Auth0 Domain],
        clientId: [Auth0 Client ID],
        clientSecret: [Auth0 Client Secret]  
    })

    var data = {
        email: 'myemail@gmail.com',
        send: 'link',
        authParams: {
            connection: [My Connection]
        } // Optional auth params.
      };
      
      auth0.passwordless.sendEmail(data, function (err) {
        if (err) {
          // Handle error.
        }
      });
})

Also, another problem with my code is the connection name which automatically sets to email rather than the custom connection name I created.

Your thoughts would be greatly appreciated.


#3

:wave: @vpanugaling what is the path you were expecting when clicking the link? Were you able to solve your issue and get the link to navigate to where you needed it to?