This part of the application is responsible for authentication. It is written in Go and tested with Go1.21
It provides a single useful API endpoint POST /login
that takes a simple JSON object and
returns an access token in case of successful authentication.
- golang:1.21
The service scans environment for variables:
AUTH_API_PORT
- the port the service takes.USERS_API_ADDRESS
- base URL of Users API.JWT_SECRET
- secret value for JWT generator.
go mod download
go build -o auth-api
AUTH_API_PORT=8081 USERS_API_ADDRESS=http://users-api:8083 JWT_SECRET=your-secret-here ./auth-api
source .env && ./auth-api
go run main.go