Skip to content

sambaraks652/web-firebase-auth-demo-GDSC---Kabarak

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Firebase and Firebase Auth Demo

Introduction

This demo showcases the basic integration of Firebase and Firebase Authentication (Auth) in a web application. Firebase is a platform developed by Google for creating mobile and web applications, and Firebase Auth provides easy-to-use authentication for your app.

Prerequisites

  • Basic knowledge of HTML, CSS, and JavaScript
  • A text editor
  • Node.js installed on your machine

Setup

  1. Firebase Project Setup:

    • Go to the Firebase Console and create a new project.
    • Add a web app to your Firebase project and follow the setup instructions to get your Firebase configuration object.
  2. Firebase Auth Setup:

    • Enable Email/Password authentication in the Firebase console under Authentication > Sign-in method.
  3. Project Structure:

    • Create an index.html file for your HTML structure.
    • Styling done by tailwind css
    • Create a scripts.js file for your JavaScript logic.

Integration Steps

  1. Include Firebase SDKs:

    • Add the Firebase scripts to your index.html file:

      <!-- Firebase App (the core Firebase SDK) is always required and must be listed first -->
      <script src="https://www.gstatic.com/firebasejs/9.15.0/firebase-app.js"></script>
      
      <!-- Add Firebase products that you want to use -->
      <script src="https://www.gstatic.com/firebasejs/9.15.0/firebase-auth.js"></script>
      <script src="https://www.gstatic.com/firebasejs/9.15.0/firebase-database.js"></script>
      <script src="https://www.gstatic.com/firebasejs/9.15.0/firebase-analytics.js"></script>
  2. Initialize Firebase:

    • Initialize Firebase with your Firebase project configuration:

      const firebaseConfig = {
        // Your Firebase project configuration
      };
      
      // Initialize Firebase
      const app = firebase.initializeApp(firebaseConfig);
      const analytics = firebase.analytics();
      const auth = firebase.auth();
      const database = firebase.database();
  3. Firebase Auth Functions:

    • Implement Firebase Auth functions in your scripts.js file:

      • Sign Up:

        function signUp(email, password) {
          // Implementation
        }
      • Sign In:

        function signIn(email, password) {
          // Implementation
        }
      • Sign Out:

        function signOut() {
          // Implementation
        }
      • Firebase Auth signup function:

        function signUp(email, password) {
          // Implementation
        }
  4. HTML Form and Event Listeners:

    • Create an HTML form for sign-up and sign-in.
    • Add event listeners to the form elements to call the Firebase Auth functions.

Conclusion

This demo provides a basic overview of integrating Firebase and Firebase Auth into a web application. Feel free to expand on this demo by adding more features and functionality based on your requirements.

About

I have forked the code of Blackie360

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 56.8%
  • JavaScript 43.2%