Skip to content

React21S/Authentication

Repository files navigation

Authentication App

  • This is an authentication app built with react context management with firebase for deployment.

SignUp page

  • Users can signup with their name, email, password and get access to enter data. Each user has their login page, where the user cannot see what is going on on another user's page.

SignUp


Login page

  • For the user to log in, it requires the user's email and password used initially for signing up for an account. After logging in, user can view their page for all necessary information previously inserted.

Login


User's page

  • After logging in, user can view their page for all necessary information previously inserted. Users can enter a new item and delete the item from their page.

LoginPage

Installation

npm install react-router-dom
npm install firebase

Needed firestore query

data query // const q = query(citiesRef, where("capital", "==", true));

after creating orderBy

  • Checking on console.log to create fetching data with an index requirements (FirebaseError: The query requires an index. You can create it here: https://console.firebase.google.com....)

set up the rules

Firestore_rule

  • Change to this line match /NPS/{document=**}
    • then publish it

Install firebase cli

Steps

curl -sL https://firebase.tools | upgrade=true bash
firebase login
firebase init

-select these line by press arrow down and space Firebase_setup after press enter

  • use exiting one
  • select the right file
  • then continue press enter
    • when it ask for
      • ? What do you want to use as your public directory? (public) change public to build
    • then choose yes
    • follow by press enter

change the firebase rule

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /NPS/{document=**} {
      // //for allowing full access just write this 
      //  allow read, write, update, delete, create;
      // allow read, write; 
      // if
      //     request.time < timestamp.date(2022, 4, 24);

    //rule to allow create 
    // must be authenticated to create
      allow create: if request.auth != null;
    
    // for allowing the user to read and delete 
    // logged in user uid must match the document creator to read & delete
      allow read, delete: if request.auth.uid == resource.data.uid;
    }
  }
}

For deploying Firebase rules

  • only desire file
firebase deploy --only firestore

Deployment through firebase

npm run build
firebase deploy

Web for this package


Acknowledgement

  • Context, Hooks, Reducers, Routing, Auth, Databases. By Net Ninja (INSTRUCTOR)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published