A Auth API docs

Start here

Overview

The Auth API is a self-hosted authentication and authorization service written in Go. It gives your applications a complete identity layer — credentials, social login, two-factor, sessions, roles and an OIDC provider — behind one HTTP API and one PostgreSQL database.

It is a service, not a library: your frontend talks to it over HTTP, and the admin GUI lets you manage tenants, applications, users, roles and email templates without touching SQL.

Who it is for

  • SaaS teams that need multi-tenant auth (one tenant → many applications) without building it from scratch.
  • Self-hosters who want their identity data in their own PostgreSQL, not in a third-party cloud.
  • Projects that need standards: OAuth2 social login, OpenID Connect, TOTP/WebAuthn two-factor, and JWT access tokens with refresh rotation.

What is included

AreaCapabilities
CredentialsEmail + password registration, login, password policies per application (length, complexity, history, max age), password reset, email verification
TokensJWT access tokens, rotating refresh tokens, Redis-backed blacklisting, per-application TTL overrides
SocialGoogle, Facebook and GitHub OAuth2, account linking, merge confirmation, signed single-use state
Two-factorTOTP, email codes, SMS codes, backup email, passkeys (WebAuthn), recovery codes, trusted devices, SMS recovery fallback
PasswordlessMagic-link login and discoverable passkeys
Multi-tenancyTenants → applications → users, per-app branding, password policy, 2FA policy and token TTLs
AuthorizationRBAC roles and permissions per application; admin API keys and per-app API keys
SessionsServer-side session registry in Redis, list/revoke endpoints, session groups for cross-app SSO
OIDCFull provider: discovery, JWKS, authorize, token, userinfo, introspect, revoke, RP-initiated logout
OperationsAdmin GUI (HTMX), webhooks, activity logs with anomaly detection, health checks, Prometheus metrics

How it is put together

        your frontend / mobile app
                   │  HTTPS + X-App-ID
                   ▼
        ┌──────────────────────┐        ┌──────────────┐
        │   Auth API (Go/Gin)  │───────▶│  PostgreSQL  │  users, tenants, apps,
        │  handlers → service  │        │              │  roles, templates, logs
        │     → repository     │        └──────────────┘
        └──────────┬───────────┘
                   │ sessions, tokens, 2FA codes, rate limits
                   ▼
             ┌───────────┐
             │   Redis   │
             └───────────┘

Every application is identified by X-App-ID. The same user email can exist in two applications and they are different users — isolation is enforced in every query.

Technology

ComponentChoice
LanguageGo (1.23+)
HTTPGin
DatabasePostgreSQL with GORM + SQL migrations
Cache / sessionsRedis
Admin UIServer-rendered Go templates + HTMX
API docsSwagger/OpenAPI generated from annotations

Next steps