authentication-authorization-skill

Authentication and authorization guidance for adding sign-in, identity checks, and rules about what each user can access. It covers common web methods such as OAuth2, JWTs, sessions, roles, passwords, and CSRF protection.

In plain words
What is it for?
Use it to build login and signup, social login, API authentication, role-based access, password handling, session management, CSRF protection, and multi-factor authentication.
Why use it?
It removes the need to piece together login and access-control security from scattered documentation. It helps avoid common mistakes when protecting accounts, forms, and APIs.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/darellchua2/opencode-config-template/authentication-authorization-skill
Any agent
npx skills add darellchua2/opencode-config-template --skill authentication-authorization-skill
Clone the repo
git clone --depth 1 https://github.com/darellchua2/opencode-config-template

Made for: Claude Code, Codex.

Per session 40 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,877 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00040 $0.04877
Opus 5 $0.00020 $0.02439
Sonnet 5 $0.00008 $0.00975
Haiku 4.5 $0.00004 $0.00488

Measured 2d ago against content hash 885bd401c00e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

authentication-authorization-skill scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

opencode_app/.opencode/skills/authentication-authorization-skill/SKILL.md · 617 lines

How it starts

The opening of the file, as written. The whole thing — 617 lines — stays where its author put it; the contents beside it link to each section on GitHub.

What I do

I help you implement secure authentication and authorization systems:

  1. OAuth2/OIDC: Authorization code, client credentials, PKCE flows
  2. JWT: Token creation, validation, rotation, and best practices
  3. Session Management: Secure session handling and storage
  4. RBAC/ABAC: Role-based and attribute-based access control
  5. Framework Integration: NextAuth/Auth.js, Passport.js, FastAPI security
  6. Password Security: Hashing, salting, and password policies
  7. CSRF Protection: Token-based and same-site cookie patterns

When to use me

Use this skill when:

  • Implementing login/signup flows
  • Setting up OAuth2 social login (Google, GitHub, etc.)
  • Designing role-based access control
  • Configuring JWT token management
  • Integrating NextAuth/Auth.js or Passport.js
  • Implementing API authentication middleware
  • Setting up password hashing and verification
  • Adding CSRF protection to forms
  • Implementing multi-factor authentication
  • security-audit-skill: Handles security auditing and vulnerability scanning. This skill handles auth implementation. CSRF here focuses on implementation patterns; security-audit focuses on detecting CSRF vulnerabilities.
  • api-design-skill: API endpoint design. This skill handles authentication middleware for those endpoints.
  • nextjs-standard-setup-skill: Project scaffolding that may include auth setup.

Step 1: OAuth2/OIDC Flows

Flow Selection

Flow Use Case Client Type
Authorization Code + PKCE SPAs, mobile apps Public
Authorization Code Server-side web apps Confidential
Client Credentials Service-to-service Confidential
Device Code CLI tools, IoT Public

Authorization Code + PKCE (Next.js)

import NextAuth from "next-auth"
import Google from "next-auth/providers/google"

export const { handlers, signIn, signOut, auth } = NextAuth({
  providers: [
    Google({
      clientId: process.env.GOOGLE_CLIENT_ID,
      clientSecret: process.env.GOOGLE_CLIENT_SECRET,
    }),
  ],
  pages: {
    signIn: "/login",
    error: "/login",
  },
  callbacks: {
    async jwt({ token, user }) {
      if (user) {
        token.id = user.id
        token.role = user.role
      }
      return token
    },
    async session({ session, token }) {
      session.user.id = token.id
      session.user.role = token.role
      return session
    },
  },
  session: {
    strategy: "jwt",
    maxAge: 24 * 60 * 60,
  },
})

Read the full file on GitHub · 617 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 617 lines · 40 tokens per session scan A 885bd401c00e

Subscribe to this mod's changes

authentication-authorization-skill is a skill published in the GitHub repository darellchua2/opencode-config-template (6 stars, last pushed 2d ago), licensed Apache-2.0. It adds 40 tokens to every session and 4,877 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens