Example cookie-based authentication with Gin
Example cookie-based authentication with Gin
A simple example demonstrating how to implement cookie-based session authentication in Go using Gin. This project showcases basic authentication flows including login, logout, and protected routes.
# Clone the repository
git clone https://github.com/depado/gin-auth-example
cd gin-auth-example
# Run the server
go run main.goThe server will start on localhost:8080
POST /login: Authenticate user{"username": "hello", "password": "itsme"}GET /logout: End user sessionGET /private/me: Get current user informationGET /private/status: Get login status/login with credentials/logout to end the sessionRun the test suite:
go test -vThis is a demonstration project. For production use:
No open issues yet, or sync has not completed.