passwordless.sendEmail (node-auth0) error

I am trying to send a OTP to a user’s email address from my Next.js app. I have configured passwordless/email in the app dashboard under authentication/passwordless. I have set up the client as follows, and checked that these env vars are returning the correct values:

import { AuthenticationClient } from 'auth0';

export const auth0 = new AuthenticationClient({
  domain: 'OUR_DOMAIN.uk.auth0.com',
  clientId: process.env.NEXT_PUBLIC_AUTH0_CLIENT_ID!,
  clientSecret: process.env.NEXT_PUBLIC_AUTH0_CLIENT_SECRET,
});

I am then using it in my app as follows:

await auth0.passwordless.sendEmail({ email: user.email, send: 'code' });

No OTP is sent, and I get the following error: “FetchError: The request failed and the interceptors did not return an alternative response”

Can someone please help?

Also, just as an aside, this post would not allow me to add “passwordless” as a tag, saying it did not exist in the “help” category. A bug, clearly, as this tag is present on other “help” entries.

1 Like