How antimatterr/go-oauth works
This Go service implements Google OAuth sign-in, verifies the returned identity, issues access and refresh tokens, and maintains an in-memory session used to protect the dashboard. The main workflow runs from HTTP routes through the auth handler, with middleware enforcing sessions and templates rendering the landing and dashboard pages. The README is empty; the map relies on the supplied source excerpts and tree. The tree spells the store directory internal/Store, while imports use internal/store; paths below follow the tree.
Main entry points: googleLogin.go Auth handler · main.go Route setup · middleware.go Auth middleware · sessionStore.go In-memory sessions
Components 13
HTTP application
- HTTP server
cmd/api/main.go - Route setup
cmd/api/main.go
Authentication
- Auth handler
internal/handlers/googleLogin.go - OAuth config
internal/config/config.go - Access JWT
internal/handlers/googleLogin.go - Token utilities
internal/utils/utils.go
Session access
- Auth middleware
internal/middleware/middleware.go - In-memory sessions
internal/Store/sessionStore.go
Web presentation
- Landing template
template/landing.html - Dashboard template
template/dashboard.html
Other components
- Browser
- Google OAuth
- Google ID validation
Connections 16
- Browser → HTTP server: HTTP requests
- HTTP server → Route setup: starts and routes
- Route setup → Auth handler: dispatches
- Route setup → Auth middleware: protects dashboard
- Auth middleware → Auth handler: calls when authorized
- Auth middleware → In-memory sessions: reads session
- Auth handler → OAuth config: uses OAuth config
- Auth handler → Google OAuth: exchanges code
- Google OAuth → Browser: authorization redirect
- Auth handler → Google ID validation: validates ID token
- Auth handler → Access JWT: generates access token
- Auth handler → Token utilities: generates session and refresh tokens
- Auth handler → In-memory sessions: writes and deletes sessions
- Auth handler → In-memory sessions: reads landing session
- Auth handler → Landing template: renders
- Auth handler → Dashboard template: renders