Categorygithub.com/tofustream/simple-auth-service
repositorypackage
0.0.0-20250213160115-bd1bbd381fb3
Repository: https://github.com/tofustream/simple-auth-service.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

Simple Auth Service

A minimal authentication service using Go, Gin, Gorm, PostgreSQL, and JWT.

Features

  • User registration (/register)

  • Login (/login)

  • Token refresh (/refresh)

  • Logout (/logout)

  • Get authenticated user (/me)

Requirements

  • Docker & Docker Compose

  • Go (if running locally)

Setup

cp .env.sample .env  # Set environment variables
docker-compose up --build

Usage

Register

curl -X POST http://localhost:8000/register \
    -H "Content-Type: application/json" \
    -d '{"email": "[email protected]", "password": "password123"}'

Login

curl -X POST http://localhost:8000/login \
    -H "Content-Type: application/json" \
    -d '{"email": "[email protected]", "password": "password123"}' \
    -c cookies.txt

Logout

curl -X POST http://localhost:8000/logout -b cookies.txt

Refresh

curl -X POST http://localhost:8000/refresh -b cookies.txt

Get User Info

curl -X GET http://localhost:8000/me -b cookies.txt