将Firebase自动生成的noreply电子邮件与Cloud Functions结合使用

时间:2019-12-21 00:58:36

标签: typescript firebase firebase-authentication google-cloud-functions

我正在使用Firebase作为后端开发移动应用程序。我的应用仅适用于特定学校的学生,因此在创建帐户之前,我需要先确定其身份(这样您就无法使用朋友的学校ID或其他任何内容)。为此,我会在创建Firebase用户之前发送带有验证码的电子邮件。

我使用nodemailer在Typescript中编写了Cloud Function来发送电子邮件,并且它运行良好。但是,它当前正在使用拥有Firebase项目的我的个人gmail帐户:

const transporter = nodemailer.createTransport({
  service: 'gmail',
  auth: {
      user: 'myfirebaseaccount@gmail.com',
      pass: 'myfirebasepassword'
  }
})

我看到Firebase Auth使用noreply@myapp.firebaseapp.com之类的noreply电子邮件进行帐户验证,密码重置和其他操作。 See Firebase Auth screenshot... (in Spanish btw)

但是,我还没有找到使该电子邮件正常工作的方法,显然是因为我不知道密码,或者密码是否存在。我尝试使用此noreply电子邮件以及我的firebase帐户密码,但运气不佳:

const transporter = nodemailer.createTransport({
  service: 'gmail',
  auth: {
      user: 'noreply@myapp.firebaseapp.com',
      pass: 'myfirebasepassword'
  }
})
Error: Invalid login: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials d7sm947636oic.46 - gsmtp

这与我在个人gmail帐户上启用“非安全”应用程序使用前的错误相同。

因此,总而言之,我不知道如何在此noreply上激活此功能,或者如何知道此电子邮件的实际密码,或者我必须更改或使用此帐户发送电子邮件的内容,或者即使完全可以使用此电子邮件地址。我尚未找到有关此主题的任何文档或信息。

0 个答案:

没有答案