Skip to content

Divyanshu227/TrueAuth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

TrueAuth Logo

TRUEAUTH

Biometric Authentication Prototype · Firebase · JWT · PostgreSQL


Overview

TrueAuth is a proof-of-concept authentication system integrating:

  • Firebase Authentication for identity verification
  • Client-side facial recognition using face-api.js
  • Express backend issuing application-level JWT tokens
  • PostgreSQL for persistent user storage

The system demonstrates hybrid authentication combining third-party identity verification with biometric enrollment and token-based authorization.


Core Features

Face-Based Registration & Login
Firebase ID Token Verification
JWT-Based Protected Routes
PostgreSQL User Persistence
Modular Backend Architecture


System Architecture

Frontend

  • React (Vite)
  • face-api.js for facial detection & embeddings
  • Firebase Client SDK
  • Axios for API communication

Backend

  • Node.js + Express
  • firebase-admin for verifying Firebase tokens
  • jsonwebtoken for issuing JWTs
  • pg for PostgreSQL integration
  • dotenv for environment configuration
  • cors for cross-origin handling

Project Structure

TrueAuth/ │ ├── Backend/ │ ├── controllers/ │ ├── routes/ │ ├── index.js │ ├── serviceAccountKey.json │ └── .env │ └── Frontend/ ├── src/ ├── components/ ├── public/models/ └── vite.config.js


Authentication Flow

  1. User authenticates via Firebase.
  2. Firebase ID token is sent to backend.
  3. Backend verifies token using firebase-admin.
  4. Backend issues application-level JWT.
  5. JWT grants access to protected routes.
  6. Facial embedding is enrolled client-side.

Environment Configuration

Create .env inside Backend/:

PORT=4000 JWT_SECRET=your_strong_secret postgres_user=your_user postgres_host=localhost postgres_db=your_database postgres_password=your_password postgres_port=5432

Do not commit:

  • .env
  • serviceAccountKey.json

Database Setup

Column Name Data Type Constraint Default Value
id PK uuid NOT NULL uuid_generate_v4()
firebase_uid text NOT NULL
name text NOT NULL
email text NOT NULL
face_embedding double precision[]
face_registered boolean false
created_at timestamp without time zone now()
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

CREATE TABLE users ( id uuid PRIMARY KEY DEFAULT uuid_generate_v4(), firebase_uid text NOT NULL UNIQUE, name text NOT NULL, email text NOT NULL UNIQUE, face_embedding double precision[], face_registered boolean DEFAULT false, created_at timestamp without time zone DEFAULT now() );


Run the Application

Backend

cd Backend
npm install
node index.js

Frontend

cd Frontend
npm install
npm run dev

Security Considerations

  • 🔐 Use a strong JWT_SECRET
  • 🚫 Never commit credentials
  • 🌐 Use HTTPS in production
  • 🚦 Add rate limiting before deployment
  • 👁️ Biometric data must be handled with extreme caution in production systems

Limitations

  • Not production-hardened
  • Limited abuse protection
  • Intended for architectural experimentation

Version

TrueAuth v1.0 — Biometric Authentication Prototype

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors