This document provides comprehensive documentation of the authentication system for the MbetterClient API endpoints, ensuring that logged-in users (admin/cashier) can access the API endpoints securely.
## Authentication System Architecture
The MbetterClient application uses a dual authentication system:
1.**Web-based Authentication**: Uses Flask-Login with user sessions for web interface access
2.**API Authentication**: Uses JWT (JSON Web Tokens) and API tokens for programmatic API access
### Public API Endpoints (No Authentication Required)
The following endpoints are intentionally public for bet verification and mobile access:
-`/api/verify-bet/<bet_id>` - Public bet verification
-`/api/verify-barcode` - Public barcode verification
-`/api/barcode/<bet_id>` - Public barcode generation
-`/api/barcode-data/<bet_id>` - Public barcode data retrieval
-`/api/templates/<template_name>` - Public template preview
### Test Endpoints
-`/api/cashier/bets/test-simple` (POST) - Test endpoint with admin authentication
The MbetterClient web dashboard implements a comprehensive authentication system that supports multiple authentication methods and role-based access control. This document outlines how authentication works and which endpoints require authentication.
-**Role-Based Access Control**: Admin, cashier, and normal user roles
-**API Token Support**: Long-lived tokens for programmatic access
-**Proper Error Handling**: Clear error responses for authentication failures
-**Extensive Coverage**: All sensitive endpoints are properly protected
-**Public Endpoints**: Limited public endpoints for bet verification
This authentication system ensures that logged-in users (admin/cashier) can securely access the API endpoints while maintaining proper access control and security.
\ No newline at end of file
### Local Development
- Requests from `127.0.0.1` or `localhost` are auto-authenticated as admin
- No tokens or sessions required for local testing