I want to send email verification code to user's email using firebase authentication. I am using (sendEmailVerification) method but firebase sends a verification link to user's email. Is it possible to send verification code to user's email if yes then how it can be done?
I am using Angular 4 and for firebase angularfire2
Thanks.
The first 10K verifications for both instances (USA, Canada, and India and All other countries) are provided at no cost each month. You are only charged on usage past this no-cost allotment. Prices are per successful verification.
You can use Firebase Authentication to enable a user to sign in to your app by sending an SMS to user's device which contains a one-time-password. The user then enters this OTP in your app, if the OTP matches then sign in is successful and the user can then access your app.
You can use Firebase Authentication to allow users to sign in to your app using one or more sign-in methods, including email address and password sign-in, and federated identity providers such as Google Sign-in and Facebook Login.
If don´t want to use the solution provided by firebase, you have to handle all the process yourself and then update the user emailVerified
data to true
.
The basic 3 steps are:
1. send an email to the user with "whatever code" you want
2. in your logic, validate the "code" typed by the user
3. use Firebase Admin SDK to update the user (you can only update this user property using the Admin SDK)
Step 3 example, using NodeJS
admin.auth().updateUser(uid, {emailVerified:true})
.then(function(userRecord) {
console.log("update success", userRecord.toJSON());
})
.catch(function(err) {
console.log("Error updating user", err);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With