To begin, open your project from where we left on in the previous video and then go to the Authenticator component TypeScript file. Import the FirebaseTSAuth class and create a FirebaseTSAuth object.
To begin, open your project from where we left on in the previous video and then go to the Authenticator component TypeScript file. Import the FirebaseTSAuth class and create a FirebaseTSAuth object.
The FirebaseTSAuth class contains functions to manage the Authentication part of Firebase.
Click on it and you will see an interface with 4 tabs. You may have to click on a button call Get Started if you do not see this page.
The Users tab will show us all the users that are registered for the app.
The Sign-in method tab is where we set how the user can register and log into our app. By default, everything is set to disable so no one would be able to register or sign in.
Click on the Email/Password provider and enable it.
If we want the user to be able to log in with their Google account, we would click on Google and enable it as well.
So right now, users can register for an account using an Email and password and also log in with that account or they can register and log in with a Google account.
The Templates tab, is where we set the template for our emails that we send out.
If we want our registered users to verify their email, we’ll run a function from the FirebaseTSAuth class and it’ll send an email to the user with this template.
The usage tab shows us how much resources we are using for Authetentication.
How your project is connected with Firebase
To remind you how our app is connected with Firebase, we imported the FirebaseTSApp class in the app module file and linked the project by calling the init function.
Modifying the Authenticator Component
Go to the Authenticator Component TypeScript file and define the function. For the type of each parameter, set it to HTMLInputElement since we are referencing input elements.
Authenticator Component TypeScript
The onFail() callback function gets triggered when it fails to create the account. Call the alert function and print out a message when it fails.
The onComplete callback function gets triggered when it completes the transaction and creates the account. Call the alert() function in here as well and print out a message.
If we go to the Firebase console and refresh the data for our users, our account will show up.
Add Login Feature
Go to the Authenticator Component TypeScript file and define the function. The type of the parameters, are also HTMLInputElements.
Inside the function:
this.firebasetsAuth.signInWith(
The onFail() callback function will get triggered when it fails to log in. Call the alert function and print out a message.
The onComplete() callback function gets triggered when it successfully logs in. Call the alert function as well.
The email and password values are used as the credentials when logging in. Replace the empty quotes with the email and password values.
If we run the app, we will be able to log in.
Adding Reset Password Feature
To add the feature for resetting the password, go back to the Authenticator Component HTML page and add a template reference for the email input.
Go to the Authenticator Component TypeScript file and define the function.
Inside the function:
To reset the password, grab the FirebaseTSAuth object and call the sendPasswordResetEmail() function.
this.firebasetsAuth.sendPasswordResetEmail(
The onComplete() callback function will get triggered at the end of the process even if it fails so keep that in mind. Add an alert() statement
The email property is the email that we want to send the instructions to.
Run the app on the browser and toggle the reset password content. Then enter the email for the account.
When you see the alert popup, log in to the email and check your inbox.
You will see a noreply email from the project.
Click on it and we will see the instructions to reset the password. If we click on the link, it will bring us to a page to reset the password.