modulepackage
0.0.0-20241213165420-eb24efcc3fc6
Repository: https://github.com/secnex/authentication-api.git
Documentation: pkg.go.dev
# README
SecNex Authentication API
This is a simple authentication API for all SecNex services. It is built using Go and PostgreSQL.
Development
- Create a
.env
file based on.env.example
and populate with your values. - Run
go run .
to start the server.
Usage
Login
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"}'
Refresh Token
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"}'
Logout
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"}'