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 |
---|---|---|
string | Email address. | |
emailLink | string | Sign-in email link. |
Returns:
- 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);