Agent skill

Auth Flows

by gjovanovicst in gjovanovicst/golang-auth-api

Detailed documentation of the 4 authentication systems, token lifecycle, middleware pipeline, session management, and RBAC authorization.

MITAuto-check passedBackend & APIs

Install Auth Flows

skills CLI
$ npx skills add gjovanovicst/golang-auth-api --skill auth-flows -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install gjovanovicst/golang-auth-api auth-flows --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/gjovanovicst/golang-auth-api.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.opencode/skills/auth-flows .claude/skills/auth-flows && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
auth-flows
GitHub stars
130
Token cost
~2.2k tokens
SKILL.md length
405 words
Files
1
Skills in repo
6
Repo updated
First seen
Licence
MIT

At a glance

Detailed documentation of the 4 authentication systems, token lifecycle, middleware pipeline, session management, and RBAC authorization.

  • Works in 4 steps: User JWT Authentication → Admin API Key Authentication → Per-Application API Key Authentication → …
  • Tasks that involve Authentication
  • SKILL.md covers Authentication Systems Overview, 1. User JWT Authentication, 2. Admin API Key Authentication and 3. Per-Application API Key…, plus 5 more sections
  • Needs ADMIN_API_KEY

What it does

Auth Flows is an agent skill from gjovanovicst/golang-auth-api. Detailed documentation of the 4 authentication systems, token lifecycle, middleware pipeline, session management, and RBAC authorization.

Its SKILL.md is about 2.2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering Authentication and Authorization and RBAC. It works with Redis. The repository describes itself as: A modern, production-ready Go REST API for authentication and authorization, featuring social login, email verification, JWT, and Redis integration. The licence is MIT.

When your agent uses it

  • Tasks that involve Authentication
  • Tasks that involve Authorization and RBAC

Example prompts

  • “/auth-flows”

Requirements

  • A credential in ADMIN_API_KEY

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. User JWT Authentication
  2. Admin API Key Authentication
  3. Per-Application API Key Authentication
  4. Admin GUI Session Authentication

What it can do on your machine

Read from SKILL.md and the folder at commit 795d18d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are go).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • ADMIN_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Auth Flows loads about 2.2k tokens when it runs. Until then it costs about 37 tokens; SKILL.md has 405 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~37
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from gjovanovicst/golang-auth-api at commit 795d18d, republished under its MIT licence (© gjovanovicst). 405 words, ~2,189 tokens.

Download SKILL.mdSave it as .claude/skills/auth-flows/SKILL.md (or your agent's skills folder).
name
auth-flows
description
Detailed documentation of the 4 authentication systems, token lifecycle, middleware pipeline, session management, and RBAC authorization.
license
MIT

Authentication Systems Overview

The project has 4 independent authentication systems:

SystemMechanismMiddleware FileContext Keys Set
User JWTBearer tokeninternal/middleware/auth.gouserID, appID, roles, sessionID
Admin API KeyStatic env + DB keysinternal/middleware/admin_auth.goauth_type = "admin"
App API KeyDB-backed per-app keysinternal/middleware/app_api_key.goauth_type = "app"
Admin GUI SessionHTTP-only cookie + Redisinternal/middleware/gui_auth.goadmin_id, admin_username, admin_session_id

1. User JWT Authentication

Token Lifecycle

Access Token:

  • Generated at login/social-login/2FA-verify/passkey-login/magic-link-verify
  • Contains: UserID, AppID, SessionID, TokenType="access", Roles[]
  • Expiry: 15 min default (configurable via ACCESS_TOKEN_EXPIRATION_MINUTES)
  • Validated by AuthMiddleware() on every protected request

Refresh Token:

  • Generated alongside access token
  • Contains: UserID, AppID, SessionID, TokenType="refresh"
  • Expiry: 720 hours default (configurable via REFRESH_TOKEN_EXPIRATION_HOURS)
  • Used via POST /refresh-token to get a new access+refresh pair
  • Old refresh token is rotated (new one issued, session updated)

Token Blacklisting (Redis):

  • Individual access token blacklisting on logout
  • User-wide token blacklisting on password change
  • Session existence check (if session revoked, token rejected)
AuthMiddleware Flow (internal/middleware/auth.go)
1. Extract "Authorization" header, strip "Bearer " prefix
2. Parse JWT via jwt.ParseToken()
3. Reject if TokenType is "refresh" (prevents refresh token misuse)
4. Check Redis: is this specific access token blacklisted?
5. Check Redis: are ALL tokens for this user blacklisted?
6. If claims.SessionID exists: check session still exists in Redis
7. Set context: userID, appID, roles, sessionID
Login Flow (standard password login)
1. POST /login with email + password
2. userHandler.Login -> userService.Login
3. Verify password with bcrypt
4. Check if 2FA is enabled for user
   - If YES: return temp 2FA token, require POST /2fa/login-verify
   - If NO: generate access+refresh tokens, create session, return tokens
5. On success: activity log "USER_LOGIN"
2FA Login Flow
1. User logs in, gets temp 2FA token
2. POST /2fa/login-verify with temp token + code (TOTP/email/recovery)
   OR POST /2fa/passkey/begin + /finish for passkey 2FA
3. Verify code against:
   - TOTP: pquerna/otp library validation
   - Email: 6-digit code stored in Redis (10 min TTL)
   - Recovery: bcrypt-hashed codes stored in user record
   - Passkey: WebAuthn assertion ceremony
4. On success: generate real access+refresh tokens, create session
Social Login Flow
1. GET /auth/{provider}/login -> redirect to OAuth provider
2. Provider redirects to GET /auth/{provider}/callback
3. Exchange code for tokens, fetch user profile
4. Find or create user (match by provider+provider_user_id+app_id)
5. Generate access+refresh tokens, create session
6. If 2FA enabled: same 2FA flow as above
1. POST /magic-link/request with email
2. Generate single-use token, store in Redis (10 min TTL)
3. Send email with magic link URL
4. POST /magic-link/verify with token
5. Validate token from Redis, delete after use
6. Generate access+refresh tokens, create session
Passkey Passwordless Flow
1. POST /passkey/login/begin -> return WebAuthn challenge
2. Client performs assertion with authenticator
3. POST /passkey/login/finish with assertion response
4. Validate credential, look up user
5. Generate access+refresh tokens, create session

2. Admin API Key Authentication

AdminAuthMiddleware Flow (internal/middleware/admin_auth.go)
1. Read X-Admin-API-Key header
2. Fast path: compare against ADMIN_API_KEY env var (constant-time)
3. Fallback: SHA-256 hash the key, look up in api_keys table
   - Validate key_type == "admin"
   - Async update last_used_at
4. Set context: auth_type = "admin"
Key Format
  • Prefix: ak_ + 24 random bytes base64-encoded
  • Storage: SHA-256 hash in DB, prefix (8 chars) + suffix (4 chars) for display
  • Generation: internal/admin/apikey_util.go

3. Per-Application API Key Authentication

AppApiKeyMiddleware Flow (internal/middleware/app_api_key.go)
1. Read X-App-API-Key header
2. Read app_id from context (set by AppIDMiddleware)
3. SHA-256 hash the key, look up in api_keys table
4. Validate key_type == "app"
5. Validate key.AppID matches context app_id (cross-app prevention)
6. Async update last_used_at
7. Set context: auth_type = "app"
AppRouteGuardMiddleware (internal/middleware/app_route_guard.go)

Additional guard that ensures the :id URL parameter matches the X-App-ID header, preventing URL manipulation attacks on /app/:id/* routes.

4. Admin GUI Session Authentication

GUIAuthMiddleware Flow (internal/middleware/gui_auth.go)
1. Read "admin_session" cookie
2. Call sessionValidator.ValidateSession(sessionID) -> *AdminAccount
3. If invalid: clear cookie, redirect to /gui/login
4. Set context: admin_id, admin_username, admin_session_id
Admin Login Flow
1. POST /gui/login with username + password
2. accountService.Authenticate(username, password) via bcrypt
3. If 2FA enabled:
   - Create pending 2FA session in Redis
   - Redirect to /gui/2fa-verify
   - POST /gui/2fa-verify with code
   - Promote pending session to full session
4. If no 2FA:
   - Create full session in Redis
   - Set admin_session cookie (HttpOnly, SameSite=Strict, Secure)
Show full SKILL.md (167 more words)Show less
Admin Sessions (Redis)
  • Stored in Redis (not JWT-based)
  • Session ID is a UUID stored in cookie
  • Session data: admin account reference
  • CSRF token generated per session
  • Separate from user sessions
CSRF Protection (internal/middleware/csrf.go)
Safe methods (GET/HEAD/OPTIONS):
  -> Generate CSRF token, store in context for template rendering

State-changing methods (POST/PUT/DELETE):
  -> Read token from X-CSRF-Token header (HTMX) OR _csrf form field
  -> Validate against session's stored token
  -> 403 on mismatch

RBAC Authorization

Permission Model

Permissions are resource:action pairs (e.g., user:read, settings:write).

AuthorizePermission Middleware (internal/middleware/auth.go)
1. Read userID and appID from context
2. Call rbacService.HasPermission(appID, userID, resource, action)
3. RBAC service checks Redis cache first, then DB
4. Cache key: rbac:{appID}:{userID}
5. Cache TTL: matches access token TTL
6. Returns 403 on failure
Default Roles (seeded per new app)
RolePermissions
adminAll permissions
memberRead + limited write
viewerRead-only
Permission Resources Used

user, settings, log -- used with actions read, write, delete.

Session Management

User Sessions (internal/session/service.go)

Redis storage:

  • session:{appID}:{sessionID} -- hash with user_id, refresh_token, ip, user_agent, created_at, last_active
  • user_sessions:{appID}:{userID} -- set of session IDs

Lifecycle:

  • Created at login (with refresh token)
  • Refreshed on token rotation (new refresh token stored)
  • Revoked individually or all-at-once
  • Max sessions enforced (oldest evicted)
Token Blacklisting (internal/redis/redis.go)
  • blacklist:access:{tokenHash} -- individual token blacklist (TTL = remaining token life)
  • blacklist:user:{userID} -- user-wide blacklist (TTL = access token TTL)

AppID Extraction (internal/middleware/app_id.go)

1. Skip for /swagger, /admin, /gui paths
2. Read X-App-ID header
3. Fallback: app_id query parameter
4. Skip for /auth/*/callback (OAuth state carries app_id)
5. Parse as UUID, set in context
Default: 00000000-0000-0000-0000-000000000001

Shared Interfaces (web/context_keys.go)

go
type SessionValidator interface {
    ValidateSession(sessionID string) (*models.AdminAccount, error)
    GenerateCSRFToken(sessionID string) (string, error)
    ValidateCSRFToken(sessionID, token string) bool
}

type ApiKeyValidator interface {
    FindActiveKeyByHash(keyHash string) (*models.ApiKey, error)
    UpdateApiKeyLastUsed(id uuid.UUID)
}

When To Use This Skill

Load this skill when working on authentication, authorization, middleware, token handling, session management, or any security-related feature.

© gjovanovicst, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .opencode/skills/auth-flows of gjovanovicst/golang-auth-api.

Open the folder on GitHubat commit 795d18d

Compare with similar skills

Auth Flows next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Auth Flows compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Auth Flows this skillgjovanovicst/golang-auth-api130—~2.2kAutomated safety check: PassMIT
Configuring Horizoncoollabsio/coolify63k4 repos~898Automated safety check: PassMIT
Cognitoitsmostafa/aws-agent-skills1.2k1 repos~2.3kAutomated safety check: PassMIT
Auth Implementation Patternsynulihao/AgentSkillOS61710 repos~4.4kAutomated safety check: PassNone
Pulse DevelopmentMineTrax/minetrax1151 repos~1.7kAutomated safety check: PassMIT
Configuration Cryptogreenpau/caddy-security2.3k—~3.5kAutomated safety check: PassApache-2.0

Similar skills

  • Configuring Horizon

    coollabsio/coolify

    A skill your agent uses whenever the user mentions Horizon by name in a Laravel context.

    63k GitHub starsUsed in 4 repos~898 tokens
    Backend & APIsAuto-check passed
  • Cognito

    itsmostafa/aws-agent-skills

    AWS Cognito user authentication and authorization service. An agent skill from itsmostafa/aws-agent-skills.

    1.2k GitHub starsUsed in 1 repo~2.3k tokens
    Backend & APIsAuto-check passed
  • Auth Implementation Patterns

    ynulihao/AgentSkillOS

    Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems.

    617 GitHub starsUsed in 10 repos~4.4k tokens
    Backend & APIsAuto-check passed
  • Pulse Development

    MineTrax/minetrax

    Handles Laravel Pulse setup, configuration, and custom card development.

    115 GitHub starsUsed in 1 repo~1.7k tokens
    Backend & APIsAuto-check passed
  • Configuration Crypto

    greenpau/caddy-security

    Configure portal/policy JWT keys, token names and lifetimes, key loading and generation, public-key discovery, and System API encryption keys.

    2.3k GitHub stars~3.5k tokensUpdated 2 days ago
    Backend & APIsAuto-check passed
  • Supercheck Security Auth

    supercheck-io/supercheck

    Work on Supercheck authentication, RBAC, tenant isolation, sessions, API and trigger keys, invitations, project membership, project variables, OAuth, super-admin behavior, SSRF, or…

    215 GitHub stars~1.2k tokensUpdated today
    Backend & APIsAuto-check passed

More from gjovanovicst/golang-auth-api

  • Admin Gui

    gjovanovicst/golang-auth-api

    Documentation of the HTMX admin GUI including template rendering, session management, CRUD patterns, and the GUIHandler structure.

    130 GitHub stars~2k tokensUpdated 2 mo ago
    Auto-check passed
  • Data Model

    gjovanovicst/golang-auth-api

    All 17 GORM database models with fields, relationships, indexes, and the entity relationship diagram for the Auth API.

    130 GitHub stars~2.7k tokensUpdated 2 mo ago
    Auto-check passed
  • Email System

    gjovanovicst/golang-auth-api

    Complete documentation of the email subsystem including template resolution, variable pipeline, rendering engines, SMTP config, and default templates.

    130 GitHub stars~1.7k tokensUpdated 2 mo ago
    Auto-check passed
  • Project Map

    gjovanovicst/golang-auth-api

    Complete module inventory of the Auth API project with file paths, dependencies, and architecture overview.

    130 GitHub stars~2.6k tokensUpdated 2 mo ago
    Auto-check passed
  • Route Map

    gjovanovicst/golang-auth-api

    Complete HTTP route structure with auth layers, middleware chains, rate limiting, and handler mappings for all API and GUI endpoints.

    130 GitHub stars~4.7k tokensUpdated 2 mo ago
    Auto-check passed

Works with

Categories

Questions about Auth Flows

What does Auth Flows do?

Detailed documentation of the 4 authentication systems, token lifecycle, middleware pipeline, session management, and RBAC authorization. Auth Flows is an agent skill from gjovanovicst/golang-auth-api. Detailed documentation of the 4 authentication systems, token lifecycle, middleware pipeline, session management, and RBAC authorization.

When should I use Auth Flows?

Auth Flows fits situations like: tasks that involve Authentication; tasks that involve Authorization and RBAC.

How do I install Auth Flows in Claude Code?

Run `npx skills add gjovanovicst/golang-auth-api --skill auth-flows -a claude-code`. Or copy the skill folder (.opencode/skills/auth-flows in gjovanovicst/golang-auth-api) into .claude/skills/auth-flows in your project. Claude Code loads it when a task matches its description.

How do I install Auth Flows in Codex?

Run `npx skills add gjovanovicst/golang-auth-api --skill auth-flows -a codex`. Or copy the skill folder (.opencode/skills/auth-flows in gjovanovicst/golang-auth-api) into .agents/skills/auth-flows in your project. Codex loads it when a task matches its description.

Can I use Auth Flows in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add gjovanovicst/golang-auth-api --skill auth-flows -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/auth-flows, .gemini/skills/auth-flows, .github/skills/auth-flows and .opencode/skills/auth-flows in your project.

What does Auth Flows need to run?

Going by SKILL.md and its folder, Auth Flows needs credentials named ADMIN_API_KEY. Our summary lists: A credential in ADMIN_API_KEY.

Does Auth Flows access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Auth Flows safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Auth Flows use?

Auth Flows is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Auth Flows use?

About 2.2k tokens (SKILL.md is roughly 8.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Auth Flows?

Skills that share tags, products or a category with Auth Flows: Configuring Horizon (coollabsio/coolify, 63k stars), Cognito (itsmostafa/aws-agent-skills, 1.2k stars), Auth Implementation Patterns (ynulihao/AgentSkillOS, 617 stars) and Pulse Development (MineTrax/minetrax, 115 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Auth Flows?

gjovanovicst (a GitHub user) maintains it in gjovanovicst/golang-auth-api, which has 130 GitHub stars. The repository holds 6 skills in this directory. The repository was last updated on July 30, 2026.

Source: gjovanovicst/golang-auth-api on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.