This is a simple authentication API for all SecNex services. It is built using Go and PostgreSQL.
- Create a
.env
file based on.env.example
and populate with your values. - Run
go run .
to start the server.
To login, send a POST request to /auth/login
with a JSON body containing the username and password.
curl -X POST http://localhost:8081/auth/login -H "Content-Type: application/json" -d '{"username": "testuser", "password": "password123"}'
To refresh the access token, send a POST request to /auth/refresh
with a JSON body containing the refresh token.
curl -X POST http://localhost:8081/auth/refresh -H "Content-Type: application/json" -d '{"refresh_token": "your_refresh_token"}'
To logout, send a POST request to /auth/logout
with a JSON body containing the refresh token.
curl -X POST http://localhost:8081/auth/logout -H "Content-Type: application/json" -d '{"refresh_token": "your_refresh_token"}'