Firebase Integration With Web Last Updated : 25 Jul, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report Firebase is a platform developed by Google for creating mobile and web applications. We will see how to integrate or connect firebase with our sample Web application.Approach: Follow the below steps to integrate your web app with firebase.Firstly we will create a HTML page in the index.html file.Once the html page is created, we will create JavaScript with the name form.js.Once this is created, log in to the firebase console and create a new project. Add any name of your choice. Once that is done, go to Authentication=>Sign-in-methodNow click on enable Email/Password.Once this step is done, Run the HTML file.Below is the implementation of above approach index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content= "width=device-width, initial-scale=1.0" /> <script src= "https://www.gstatic.com/firebasejs/8.2.7/firebase-app.js"> </script> <script src= "https://www.gstatic.com/firebasejs/8.2.7/firebase-auth.js"> </script> <script src="form.js"></script> <title>Login System</title> </head> <body> <div class="formContainer"> <h1>Enter Credentials Here:</h1> <input type="email" placeholder="email here" id="email" /> <br /> <input type="password" placeholder="password here" id="password" /> <br /> <button onclick="signUp()" id="signUp"> SignUp </button> <button onclick="signIn()" id="signIp"> SignIn </button> <button onclick="signOut()" id="signOut"> SignOut </button> </div> </body> </html> Now make a form.js file and add javascript code that will contain firebase configuration details and API key. form.js // Your web app's Firebase configuration // For Firebase JS SDK v7.20.0 and later, // measurementId is optional var firebaseConfig = { apiKey: "AIzaSyAv_PFCLcflPPO5NYtXkz5r-H9J2IEQzUQ", authDomain: "login-demo-a03bf.firebaseapp.com", projectId: "login-demo-a03bf", storageBucket: "login-demo-a03bf.appspot.com", messagingSenderId: "831896060677", appId: "1:831896060677:web:a0616c95abc1bcdedf6d6c", measurementId: "G-XWHF8K6XSV", }; // Initialize Firebase firebase.initializeApp(firebaseConfig); const auth = firebase.auth(); // Signup function function signUp() { var email = document.getElementById("email"); var password = document.getElementById("password"); const promise = auth.createUserWithEmailAndPassword( email.value, password.value ); promise.catch((e) => alert(e.message)); alert("SignUp Successfully"); } // SignIN function function signIn() { var email = document.getElementById("email"); var password = document.getElementById("password"); const promise = auth.signInWithEmailAndPassword( email.value, password.value); promise.catch((e) => alert(e.message)); } // SignOut function signOut() { auth.signOut(); alert("SignOut Successfully from System"); } // Active user to homepage firebase.auth().onAuthStateChanged((user) => { if (user) { var email = user.email; alert("Active user " + email); } else { alert("No Active user Found"); } }); Now in the firebase dashboard, go to Authentication=>Sign-in-method.Now to see the complete output of the above implementation do the following:Once you enter the details, and click the sign-up button, the page will display a pop-up message saying the user is successfully signed in. This means that the data is saved in firebase. Go to firebase->build->authentication->users. Here you will find the email-id and the password saved.Output:Now your web application is integrated with firebase. Comment More infoAdvertise with us Next Article Firebase Integration With Web D deepthikamath Follow Improve Article Tags : Firebase JavaScript-Questions Similar Reads Non-linear Components In electrical circuits, Non-linear Components are electronic devices that need an external power source to operate actively. Non-Linear Components are those that are changed with respect to the voltage and current. Elements that do not follow ohm's law are called Non-linear Components. Non-linear Co 11 min read Spring Boot Tutorial Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance 10 min read JavaScript Interview Questions and Answers JavaScript is the most used programming language for developing websites, web servers, mobile applications, and many other platforms. In Both Front-end and Back-end Interviews, JavaScript was asked, and its difficulty depends upon the on your profile and company. Here, we compiled 70+ JS Interview q 15+ min read Class Diagram | Unified Modeling Language (UML) A UML class diagram is a visual tool that represents the structure of a system by showing its classes, attributes, methods, and the relationships between them. It helps everyone involved in a projectâlike developers and designersâunderstand how the system is organized and how its components interact 12 min read 3-Phase Inverter An inverter is a fundamental electrical device designed primarily for the conversion of direct current into alternating current . This versatile device , also known as a variable frequency drive , plays a vital role in a wide range of applications , including variable frequency drives and high power 13 min read Backpropagation in Neural Network Back Propagation is also known as "Backward Propagation of Errors" is a method used to train neural network . Its goal is to reduce the difference between the modelâs predicted output and the actual output by adjusting the weights and biases in the network.It works iteratively to adjust weights and 9 min read What is Vacuum Circuit Breaker? A vacuum circuit breaker is a type of breaker that utilizes a vacuum as the medium to extinguish electrical arcs. Within this circuit breaker, there is a vacuum interrupter that houses the stationary and mobile contacts in a permanently sealed enclosure. When the contacts are separated in a high vac 13 min read Polymorphism in Java Polymorphism in Java is one of the core concepts in object-oriented programming (OOP) that allows objects to behave differently based on their specific class type. The word polymorphism means having many forms, and it comes from the Greek words poly (many) and morph (forms), this means one entity ca 7 min read CTE in SQL In SQL, a Common Table Expression (CTE) is an essential tool for simplifying complex queries and making them more readable. By defining temporary result sets that can be referenced multiple times, a CTE in SQL allows developers to break down complicated logic into manageable parts. CTEs help with hi 6 min read Python Variables In Python, variables are used to store data that can be referenced and manipulated during program execution. A variable is essentially a name that is assigned to a value. Unlike many other programming languages, Python variables do not require explicit declaration of type. The type of the variable i 6 min read Like