Skip to content

aliheader/fastapi-jwt-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI JWT Authentication

This repository provides a simple implementation of JWT (JSON Web Tokens) authentication in FastAPI.

Features

  • User authentication using JWT tokens
  • Token generation endpoint
  • Basic error handling
  • Scalable and extensible architecture

Requirements

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/fastapi-jwt-auth.git
  2. Navigate into the cloned directory:

    cd fastapi-jwt-auth
  3. Install the dependencies:

    pip install -r requirements.txt
    pip install -r requirements-dev.txt

Usage

  1. Start the FastAPI server:

    uvicorn main:app --reload
  2. 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.

Configuration

  • You can configure the JWT secret key, token expiration time, and other settings in the config.py file.

Contributing

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.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published