OTP For Existing Users Only We use the /auth/dash...
# support-questions-legacy
e
OTP For Existing Users Only We use the /auth/dashboard to create the user. We want to only allow existing users to receive an OTP. For the backend middle tier, how would this be done? Most likley, in the config.js. So, can we add something to the Passwordless.init({...})?
Copy code
import Passwordless from 'supertokens-node/recipe/passwordless';
import Session from 'supertokens-node/recipe/session';

// eslint-disable-next-line import/prefer-default-export, arrow-body-style
const getBackendConfig = () => {
  return {
    ...,
    Passwordless.init({
      flowType: 'USER_INPUT_CODE',
      contactMethod: 'EMAIL_OR_PHONE',
      whatCouldWeAddHere: ?????
    }),
    ...,
  };
};

export default getBackendConfig;
r
Hey.
e
Hi!
r
Checkout our docs on sending custom sms (sms delivery section)
You can override the sendSms function to first check if the user exists, and if they do, only then call the original implementation, else do nothing
e
I can add role/etc. (https://supertokens.com/docs/userroles/introduction) but is there a way to add users too? We can't add users in the dashboard (yet).
r
You can create an api that’s accessible only by you, and then in that, call the Passwordless.signInUp function with the phone number you want to create a user for
r
Yea. For not sending sms if the user doesn’t exist
e
and is there something similar for email? emailDelivery?
r
Yup
Ok. Thank you! You rock.
2 Views