03 - Login and Broker Login Flow
Overview
Authentication Flow Diagram

Phase 1: User Authentication
Initial Setup Check
Login Endpoint
Password Validation
Password Hashing
Phase 2: Broker Authentication
Broker Types and Auth Methods
Auth Type
Brokers
Flow
OAuth2 Flow (e.g., Zerodha)
TOTP Flow (e.g., Angel)
Broker Callback Handler
Authentication Success Handler
Session Management
Session Data Structure
Session Expiry
Session Cookie Security
Token Storage
Auth Token Encryption
Database Schema (Auth)
Password Reset Flow
Reset Methods
Reset Endpoint
Frontend Session Sync
React AuthSync Component
Session Status Endpoint
Logout Flow
Security Considerations
Rate Limiting
Endpoint
Limit
User Enumeration Prevention
CSRF Protection
Key Files Reference
File
Purpose
Last updated