The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Home > @firebase/auth > EmailAuthProvider > credentialWithLink

EmailAuthProvider.credentialWithLink() method

Initialize an AuthCredential using an email and an email link after a sign in with email link operation.

Signature:

static credentialWithLink(email: string, emailLink: string): EmailAuthCredential;

Parameters

Parameter Type Description
email string Email address.
emailLink string Sign-in email link.

Returns:

EmailAuthCredential

  • The auth provider credential.

Example 1

const authCredential = EmailAuthProvider.credentialWithLink(auth, email, emailLink);
const userCredential = await signInWithCredential(auth, authCredential);

Example 2

await sendSignInLinkToEmail(auth, email);
// Obtain emailLink from user.
const userCredential = await signInWithEmailLink(auth, email, emailLink);