diff --git a/auth/email_action_links.js b/auth/email_action_links.js index 6d2d14bc..5c21b09d 100644 --- a/auth/email_action_links.js +++ b/auth/email_action_links.js @@ -38,35 +38,39 @@ getAuth() }); // [END password_reset_link] -// [START email_verification_link] -// Admin SDK API to generate the email verification link. -const useremail = 'user@example.com'; -getAuth() - .generateEmailVerificationLink(useremail, actionCodeSettings) - .then((link) => { - // Construct email verification template, embed the link and send - // using custom SMTP server. - return sendCustomVerificationEmail(useremail, displayName, link); - }) - .catch((error) => { - // Some error occurred. - }); -// [END email_verification_link] +function emailVerificationLink() { + // [START email_verification_link] + // Admin SDK API to generate the email verification link. + const useremail = 'user@example.com'; + getAuth() + .generateEmailVerificationLink(useremail, actionCodeSettings) + .then((link) => { + // Construct email verification template, embed the link and send + // using custom SMTP server. + return sendCustomVerificationEmail(useremail, displayName, link); + }) + .catch((error) => { + // Some error occurred. + }); + // [END email_verification_link] +} -// [START sign_in_with_email_link] -// Admin SDK API to generate the sign in with email link. -const usremail = 'user@example.com'; -getAuth() - .generateSignInWithEmailLink(usremail, actionCodeSettings) - .then((link) => { - // Construct sign-in with email link template, embed the link and - // send using custom SMTP server. - return sendSignInEmail(usremail, displayName, link); - }) - .catch((error) => { - // Some error occurred. - }); -// [END sign_in_with_email_link] +function signInWithEmailLink() { + // [START sign_in_with_email_link] + // Admin SDK API to generate the sign in with email link. + const useremail = 'user@example.com'; + getAuth() + .generateSignInWithEmailLink(useremail, actionCodeSettings) + .then((link) => { + // Construct sign-in with email link template, embed the link and + // send using custom SMTP server. + return sendSignInEmail(useremail, displayName, link); + }) + .catch((error) => { + // Some error occurred. + }); + // [END sign_in_with_email_link] +} let displayName; const sendSignInEmail = (...args) => {