8

Go MongoDB JWT Auth Service

This project is a simple Dockerized REST API that demonstrates how to implement user authentication using Go, MongoDB, and JSON Web Tokens (JWTs).

Endpoints

/adduser

curl -X POST \
  http://localhost:8080/adduser \
  -H 'Content-Type: application/json' \
  -d '{
    "username": "jane",
    "password": "s3cr3t"
  }'

/login

curl -X POST \
  http://localhost:8080/login \    
  -H 'Content-Type: application/json' \  -d '{
    "username": "john",
    "password": "p4ssw0rd"
  }'  

/protected

curl -X GET \ 
  http://localhost:8080/protected \
  -b 'token=$TOKEN'