Update README to document username-based authentication

This commit is contained in:
Automated Action 2025-05-26 14:14:50 +00:00
parent 185226a858
commit 1318b2a78b

View File

@ -8,7 +8,7 @@ A full-featured e-commerce API built with FastAPI and SQLite.
- **Product Management**: Products with categories, pricing, and inventory management
- **Shopping Cart**: Add, update, remove items in user's shopping cart
- **Order Processing**: Create orders from cart, track order status
- **Authentication**: JWT-based authentication with role-based access control
- **Authentication**: Username-based JWT authentication with role-based access control
## Tech Stack
@ -23,8 +23,8 @@ A full-featured e-commerce API built with FastAPI and SQLite.
### Authentication
- `POST /api/v1/auth/login`: Login and get access token
- `POST /api/v1/auth/register`: Register a new user
- `POST /api/v1/auth/login`: Login with username and password to get access token
- `POST /api/v1/auth/register`: Register a new user (requires username, email, and password)
- `GET /api/v1/auth/me`: Get current user information
### Users
@ -104,6 +104,13 @@ uvicorn main:app --reload
The API will be available at http://localhost:8000.
### Authentication Note
This API uses username-based authentication rather than email-based. When registering and logging in:
- Username is the primary identifier for authentication
- Email is still required during registration but is not used for login
- Password must meet security requirements (minimum 8 characters)
## Documentation
FastAPI provides automatic API documentation:
@ -124,6 +131,10 @@ Apply migrations:
alembic upgrade head
```
#### Recent Migrations
- **2a3b4c5d6e7f_add_username_field**: Added username field to User model and migrated from email-based to username-based authentication
### Running Tests
```bash