Skip to content

Latest commit

 

History

History
48 lines (37 loc) · 1.16 KB

README.md

File metadata and controls

48 lines (37 loc) · 1.16 KB

FastAPI JWT Auth

  1. Copy environment configuration and update config

    cp example.env .env
  2. Install the requirements:

    poetry install -v
  3. Init python environment:

    poetry shell
  4. Run the app:

    python main.py
  5. Test at http://localhost:8080/docs

  6. Get bearer token by logging in with expected client configuration:

    curl -X 'POST' \
    'http://localhost:8080/client/login' \
    -H 'accept: application/json' \
    -H 'Content-Type: application/json' \
    -d '{"team_name": "ateam", "client_id": "123456789", "client_secret": "weaksecret"}'
  7. Use the bearer token returned from the last step to authenticate with protected endpoints.

    curl -X 'GET' \
    'http://0.0.0.0:8080/ping' \
    -H 'accept: application/json' \
    -H 'Authorization: Bearer XXXXXXXXYYYYYYZZZZZZ'
  8. Follow the auth guide for local setup

output