implement JWT tokens, regenerate docs and sqlc

This commit is contained in:
zardzul
2026-03-14 18:46:48 +01:00
parent 131aee8638
commit d5e608feeb
18 changed files with 441 additions and 82 deletions
+13
View File
@@ -2,6 +2,19 @@
Music collection software for indexing bought (physical) albums. Build with Golang and Postgres
## Authentication
JWT authentication is enabled for protected endpoints.
Set these environment variables for the API:
- `JWT_SECRET` (required)
- `JWT_ISSUER` (optional, defaults to `music-index-api`)
- `JWT_TTL_MINUTES` (optional, defaults to `60`)
Get a token via `POST /api/v1/users/login` and include it as:
`Authorization: Bearer <token>`
## Swagger
The API documentation is available at [/api/v1/swagger/index.html](http://localhost:8080/api/v1/swagger/index.html) after running the application. It provides details about the available endpoints, request/response formats, and other relevant information for developers to interact with the API effectively.