This repository contains a comprehensive collection of authentication services implemented as part of the ALX Backend specialization. It includes three major authentication implementations:
- Basic Authentication - Simple token-based authentication
- Session Authentication - Cookie-based session management
- User Authentication Service - Full-featured authentication system with database integration
A simple REST API authentication system using Base64-encoded credentials.
Key Features:
- Base64 encoding/decoding of credentials
- Authorization header validation
- Protected routes with authentication requirements
- Proper error handling (401 Unauthorized, 403 Forbidden)
A more advanced authentication system using session cookies.
Key Features:
- Cookie-based session management
- Session ID generation and validation
- Login/logout functionality
/users/meendpoint for current user- Session expiration (advanced)
- Database-backed sessions (advanced)
A complete user authentication service with database integration.
Key Features:
- User registration with email/password
- Password hashing with bcrypt
- Session management
- Password reset functionality
- SQLAlchemy database integration
- Comprehensive API endpoints
- Framework: Flask
- Database: SQLite (SQLAlchemy ORM)
- Security: bcrypt for password hashing
- Session Management: UUID tokens
- Testing: Python unittest
- Python 3.7+
- pip
- SQLite (for User Authentication Service)
-
Clone the repository:
git clone https://github.com/SHEFOO10/alx-backend-user-data.git cd alx-backend-user-data -
Install dependencies:
pip install -r requirements.txt
Each service can be run independently:
-
Basic Authentication:
cd 0x01-Basic_authentication/ python3 -m api.v1.app -
Session Authentication:
cd 0x02-Session_authentication/ python3 -m api.v1.app -
User Authentication Service:
cd 0x03-user_authentication_service/ python app.py
Each service has its own API documentation in its respective directory:
Integration tests are provided for the User Authentication Service:
cd 0x03-user_authentication_service/
python main.pyThrough these projects, you will learn:
- Authentication concepts and implementation
- Security best practices (password hashing, session management)
- REST API design with Flask
- Database integration with SQLAlchemy
- Error handling and validation
- Testing authentication flows