This repository provides a simple implementation of JWT (JSON Web Tokens) authentication in FastAPI.
- User authentication using JWT tokens
- Token generation endpoint
- Basic error handling
- Scalable and extensible architecture
- Python 3.7+
- FastAPI
- Python-Jose
- uvicorn
-
Clone the repository:
git clone https://github.com/your-username/fastapi-jwt-auth.git
-
Navigate into the cloned directory:
cd fastapi-jwt-auth
-
Install the dependencies:
pip install -r requirements.txt pip install -r requirements-dev.txt
-
Start the FastAPI server:
uvicorn main:app --reload
-
Access the token generation endpoint:
Open your web browser or use a tool like Postman to send a POST request to
http://localhost:8000/api/auth/access-token
. Include the username and password in the body (form-data) to receive a JWT token in response.
- You can configure the JWT secret key, token expiration time, and other settings in the
config.py
file.
Contributions are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.
This project is licensed under the MIT License.