Firebase Hooksv0.3.0

useVerifyEmail

Apply the emailed verification code on mount.

Unlike the other hooks, this one runs on mount and reports a status the page renders from. Pass the oobCode from the URL, or null while you're still reading it.

const { status, error } = useVerifyEmail(searchParams.get('oobCode'), {
  onVerified: refreshSession,
});

if (status === 'pending') return <Spinner />;
if (status === 'error') return <ErrorState message={error} />;
return <SuccessState />;

Returns

status is "pending", "success", or "error" — exported as VerifyEmailStatus, and the same AsyncStatus vocabulary every status in the package uses. error carries the message on failure.

Notes

Guarded against React Strict Mode's double effect, because the code is single-use — without that guard the second run always fails.

After verifying, the current user is reloaded and the token refreshed so emailVerified propagates, then onVerified runs.

Options

Prop

Type

All three emailed links land on one URL — see One page for every emailed link for the page that dispatches on mode.

On this page