Firebase - Send Password via Email after User Account Creation - javascript

I am working on a college app in which only the administrator has the right to create user accounts. On successful User Account creation, the user gets an email with his user email and password as plain text.
I am already familiar with the email verification and password reset mail in firebase but I am not allowed to do that.
I already looked at answer to this question: Send User Password via Email with Firebase but it is very less helpful as the answer provided is complicated to understand.
So all I want is the password to be sent via email whenever a user is created.
PS: I am working with Web Interface (JavaScript). How do I do that? It would be even nice if I get help with some code chunks included.

You can achieve this using firebase cloud functions following the steps below
Setup Admin SDK following the documentation https://firebase.google.com/docs/admin/setup
Add a Firebase Authentication Listener https://firebase.google.com/docs/functions/auth-events
You can send mail with sendgrid See this article
If you want to really get familiar with cloud functions you can start here

Related

How can I acess content of email triggered by a test in Cypress

An email is being sent in my case ( 1. When resetting the password, 2. Adding a New member) during both API and UI tests.
How can I access these emails without actually logging into my mail manual and accessing the content, so I can add them to the test and verify?
The test is something like the below.
User can reset the password.
Mail is triggered.
User uses the link in the mail to reset the password.
User logs in again using the new password.
Second test.
Admin adds a member.
Admin adds a new member and gets a mail about confirmation.
verify the mail sent to the new member's email.
Would appreciate any help here.
I have tried to look into the third parties but it seems I need to use their email accounts I was hoping if someone can help me regarding Gmail(accessing the content of emails going to Gmail)
If your application is running locally and is sending the emails directly through an SMTP server, you can use a temporary local test SMTP server running inside Cypress. Read the blog post "Testing HTML Emails using Cypress" for details.
If your application is using a 3rd party email service, or you cannot stub the SMTP requests, you can use a test email inbox with an API access. Read the blog post "Full Testing of HTML Emails using SendGrid and Ethereal Accounts" for details.
Taken from the official best practice page at "Verifying sent emails". Read more here.
If you are looking for a free third-party email client (of course with just 100 emails per month) you can use testmail.app
This app is pretty much basic and easy to integrate with cypress.
You can find docs here
To check if an email have been correctly sent by your application in a Cypress E2E test, you can use an external service like TestSendr.
This (free) service will allow you to send an email to something ending by #testsendr.link, and then check the email received via a simple REST API. Check the quick start!

Not receiving sign in email with firebase email link authentication on some emails

I have firebase email link authentication configured as it is told in the docs. But a few users don't get the sign in email. Why is this happening. One of my friends tried to login with one email and didn't get the email. He then tried with another email and it worked.
I am also not getting an email on some of my emails.
How do I resolve this issue?
Firebase makes no distinction based on the email addresses. Most likely the message got marked as spam for some of your friends. Have them check the spam box of their mail client, and any spam filters they have on their network.
Also see my answer here for some (progressively involved) workarounds: Why did this code fail to send password reset link in firebase (Reactjs)?

Firebase user signup with email and send them password via email

I'm trying to allow users to sign up to a Firebase website using only their email and phone number. At a later time, I would like to send them their auto-generated password via email. Is this possible to do with Firebase Auth or Realtime Database?
Sure thing. You'll have to create the account through the Admin SDK, so in a trusted environment like your dev machine, a server you control, or Cloud Functions. There you call createUser(...) with the email the user entered, the a temporary password that you made up.
You could do the same client-side, but in that case the password would be determined from the client too, which wouldn't be secure.

How do I set up a user's phone number as a password recovery option in Nodejs

I'm working on a nodejs project, I used passportjs in nodejs to create a login system. Everything seems ok, but I do not know how I can go about password recovery so that in the case of a lost or forgotten password, you have the option to receive a text message (SMS) or voice call to recover your account.
I want trying How To Implement Password Reset In Node.js, but the example there show password recovery via email.
I have checked this Stackoverflow questions already, but none of them helps in what I plan to archive:
How can I send verfication codes to mobile numbers in node.js? (Like nodemailer, but for SMS)
Password Reset In NodeJS
reset / change password in nodejs with passportjs
I will greatly appreciate any help.
Thank a million in advance.
Disclaimer, I do not have experience in Nodejs and this is a rough example.
Find a service that can send texts to users such as twilio.
Generate an authentication code using a random generator when user presses button. Use that authentication code as a key to a map where the value is the user.
Then when the user inputs the code you can lookup the User to reset using the map created before.
The map you would want to store in your database.

parse.com - How to generate and add verification url within email?

I am using parse.com as backend for my android application.
On signup, an email is sent to user with the help of my parse cloud code and mailgun api integration. My code works fine for sending email.
But I am unable to understand how to add an auto-generated url within my mail, to verify the user's email address and save that information in the parse database.
What i have tried is, turning on email verification option, but don't know what to do next. Also, I am using my own domain for sending email and not parse one. Would really appreciate any help. Thanks
Goto your dashboard-> App Settings-> Hosting and Email. There you will able to find Email Settings. Enable "Verify User Emails" . DONE

Categories