[英]How can we build a node api which will send mail to users and will also generate otp for accessing my python microservices
Is there a way to write an email API on nodejs so that an email containing unique auto-generated OTP will be sent to the user in order to access my python micro-services? Is there a way to write an email API on nodejs so that an email containing unique auto-generated OTP will be sent to the user in order to access my python micro-services?
Nodemailer is a popular module for sending email inside nodejs. Nodemailer是一个流行的模块,用于在 nodejs 中发送 email。 You can find all the details on the website.
您可以在网站上找到所有详细信息。
Alternatively, you can use 3rd party API for handling transactional emails.或者,您可以使用第 3 方 API 来处理交易电子邮件。 In my experience, SendGrid does the job and has a neat API that's easy to implement.
以我的经验, SendGrid完成了这项工作,并且有一个易于实现的简洁 API。
As far as OTP goes, you can use whatever you prefer to generate the password, just never use Math.random
because it's not secure.就 OTP 而言,您可以使用任何您喜欢的方式来生成密码,只是永远不要使用
Math.random
,因为它不安全。 In general, this is how I would structure my app:一般来说,这就是我构建我的应用程序的方式:
If you need any code examples or anything else let me know and I'll edit my answer.如果您需要任何代码示例或其他任何内容,请告诉我,我将编辑我的答案。 Hope this helps:)
希望这可以帮助:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.