Skip to content

Documentation / react-auth / UseLoginWithEmail

Type alias: UseLoginWithEmail

UseLoginWithEmail: Object

Type declaration

loginWithCode

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

Log a user in with a one-time-passcode (OTP) that has been sent to their email address 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: ({email}) => Promise<void>

Sends a one-time-passcode (OTP) to the user's email address.

Parameters

{email}: SendCodeToEmail

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 Email flow.