A full-stack web authentication system built using FastAPI and React, implementing secure JWT-based authentication with HTTP-only cookies, user registration, login, protected routes, and logout functionality.
- π Secure login and registration using JWT tokens (stored in HTTP-only cookies)
- π Password hashing with bcrypt
- β Protected API routes using FastAPI dependencies
- π§ͺ Integration tests with Pytest
- π― Token expiration, logout, and cookie invalidation
- π CORS configuration for frontend/backend communication
- React (Hooks, Axios, React Router)
- JavaScript (ES6+)
- HTML5, CSS3
- FastAPI
- Python
- Pydantic
- bcrypt, JWT
- Pytest (Unit & Integration Tests)
git clone https://github.com/Darrius-W/Auth-Python.git
cd FastAPI-React-Auth
cd server
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --reload
cd client
npm install
npm start
cd server
pytest
- Signup or Login from React frontend
- Backend returns JWT token in an HTTP-only cookie
- Protected routes are accessed only if token is valid
/logoutdeletes cookie and ends session
- Visit
/profileto see a protected page after logging in - Manually clear cookies or logout to simulate session expiration
- β Tested signup, login, protected route access, and logout with Pytest
- β Simulated cookie handling in test client
- β Covers valid and invalid authentication paths