Vincent Panugaling
Vincent Panugaling

Reputation: 906

Passwordless Authentication in Node using Auth0

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: '[email protected]',
        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.

Upvotes: 2

Views: 694

Answers (1)

thameera
thameera

Reputation: 9473

I assume you are getting the Consent screen here. Are you using a localhost URL? In that case it's not possible to skip it, but it won't appear when your app is in production, or if you set up a domain in /etc/hosts file. More info here: https://auth0.com/docs/api-auth/user-consent#skipping-consent-for-first-party-clients

The name of the passwordless email connection is usually email.

Upvotes: 1

Related Questions