Hi, we have successfully implemented passwordless authentication in our application. Now we would like to disable the registration of new users, so that only the login works and not the registration.
We have implemented the following in the Nestjs backend:
Passwordless.init({
override: {
apis: (originalImplementation) => {
return {
...originalImplementation,
createCodePOST: async function (input) {
const existingUser = await Passwordless.getUserByEmail({
email: (input as { email: string }).email,
});
if (!!existingUser) {
throw new ForbiddenException(
'Creating a new user is not allowed'
);
}
return await originalImplementation.createCodePOST(input);
},
};
},
},
...
Now this works fine, but in the frontend I don't see the error message
Creating a new user is not allowed
but
Something went wrong. Please try again
. Now 2 questions: 1. is this the right way to deactivate the registration of new users in the passwordless authentication? 2. how can I override the default error message in the FE? Thanks a lot 🙂