Skip to content

Documentation / react-auth / UseLoginWithSms

Type alias: UseLoginWithSms ​

UseLoginWithSms: Object

Type declaration ​

loginWithCode ​

loginWithCode: ({code}) => Promise<void>

Log a user in with a one-time-passcode (OTP) that has been sent to their phone number via [sendCode](Property sendCode: Function)

For a single OTP, you may call this method up to a maximum of 5 times, to handle errors where the user incorrectly enters the OTP in your UIs.

After 5 attempts of [loginWithCode](Property loginWithCode: Function), the existing OTP is no longer valid, and you must request a new one for the user via [sendCode](Property sendCode: Function)

Parameters ​

• {code}: LoginWithCode

Returns ​

Promise<void>

a Promise that resolves if the inputted OTP was valid, or rejects if there was an error.

sendCode ​

sendCode: ({phoneNumber, disableSignup}) => Promise<void>

Sends a one-time-passcode (OTP) to the user's phone number.

Parameters ​

• {phoneNumber, disableSignup}: SendCodeToSms

Returns ​

Promise<void>

a Promise that resolves if the OTP was successfully sent to the email, or rejects if there was an error.

state ​

state: OtpFlowState

The current state of the login with SMS flow.