useUpdateEmail
Change the email via verify-before-update.
const { update, isSuccess } = useUpdateEmail();
await update(newEmail, { currentPassword }); // password account
await update(newEmail); // OAuth account
{
isSuccess && <p>Check {newEmail} to confirm the change.</p>;
}Returns
update(newEmail, { currentPassword? }) resolves to { success: true } or a failure result. Also exposes status, isPending, isSuccess, error, and reset.
isSuccess means "email sent"
This uses Firebase's verifyBeforeUpdateEmail. Firebase mails a verification link to the new address, and the change lands only when it's clicked.
So isSuccess means the verification email went out — not that the email changed. Word your UI accordingly.
Reauthentication
Pass currentPassword for automatic reauthentication. Omit it for OAuth-only accounts, which have no password, and handle a stale session with useReauthenticate.
Options
Prop
Type