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. You can find all the details on the website.
Alternatively, you can use 3rd party API for handling transactional emails. In my experience, SendGrid does the job and has a neat API that's easy to implement.
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. 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 :)