theauth-go drops into a Gin router by mounting its handlers onto a chi
subrouter, then wrapping the result with gin.WrapH. The same pattern
works for any third-party router that accepts an http.Handler.
- Go 1.25 or newer.
- Docker (only if you want the Postgres backed variant; in-memory is the default).
cp .env.example .env
make up # optional: starts Postgres on port 5433
make run
Server listens on :8081. The auth routes mount under /auth/.
# request a magic link (noop sender prints the URL to your terminal)
curl -X POST http://localhost:8081/auth/magic-link \
-H 'Content-Type: application/json' \
-d '{"email":"you@example.com"}'
# paste the verify URL from the server logs into your browser.
# check the authenticated user (cookie set by the verify endpoint)
curl --cookie-jar c.txt --cookie c.txt http://localhost:8081/me
make down
- Port 8081 already in use: set
ADDR=:8090in.envand re-run. BASE_URLmismatch on OAuth callback: the magic link URL embedded in the email points atBASE_URL, which must match what your browser sees.- Postgres up but
DATABASE_URLnot set: the example only uses the in-memory store. Wire Postgres yourself by importinggithub.com/glincker/theauth-go/v2/storage/postgresand swapping the storage adapter inmain.go.