useEmailLinkSignIn
Passwordless magic-link sign-in, with no window.prompt.
Two steps across two page loads: send the link, then complete the sign-in when the user clicks it.
// Request page
const { sendLink } = useEmailLinkSignIn({
actionCodeSettings: { url: `${origin}/auth/callback`, handleCodeInApp: true },
});
await sendLink(email);
// Callback page
const { completeSignIn } = useEmailLinkSignIn({ onIdToken: createSession });
const result = await completeSignIn(window.location.href);
if (!result.success && result.needsEmail) showEmailConfirmField();Returns
sendLink(email) emails the link and remembers the address in localStorage.
Set the sendEmail option to send it from your own API instead — the same option name the other two emailed-link hooks take, or set all three at once with the provider's senders.
completeSignIn(url, email?) resolves to { success: true, user, credential } or a failure result, exported as CompleteSignInResult — a failure there also carries needsEmail.
Also exposes status, isPending, error, and reset.
When the link opens on another device
The stored address won't be there. Rather than calling window.prompt, the result carries needsEmail: true — render your own input and call completeSignIn again with the address.
const result = await completeSignIn(url, confirmedEmail);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.