LU

luz-oauth2-authorization-code

Applies the OAuth2 Authorization Code design pattern for delegating authentication to external servers.

Install

mkdir -p .claude/skills/luz-oauth2-authorization-code && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/18325" && unzip -o skill.zip -d .claude/skills/luz-oauth2-authorization-code && rm skill.zip

Installs to .claude/skills/luz-oauth2-authorization-code

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Apply the OAuth2 Authorization Code design pattern. Use when user login delegates authentication to an authorization server. Includes when to use it, when not to use it, benefits, trade-offs, mistakes, checklist, examples, testing, security, observability, and related pattern guidance.
286 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Intermediate

Key capabilities

  • Obtain tokens through an authorization server after user consent
  • Use PKCE for public clients
  • Keep tokens out of URLs
  • Clarify ownership and intent for authentication patterns
  • Improve testability by assigning explicit roles
  • Reduce duplication by structuring repeated decisions

How it works

The authorization code flow allows a client to obtain tokens through an authorization server after user consent or authentication.

Inputs & outputs

You give it
User consent or authentication
You get back
Tokens obtained through an authorization server

When to use luz-oauth2-authorization-code

  • Implement oauth2 login flow
  • Validate token security patterns
  • Set up authorization code authentication

About this skill

OAuth2 Authorization Code

What It Is

Use the authorization code flow so a client obtains tokens through an authorization server after user consent or authentication.

When To Use It

  • User login delegates authentication to an authorization server.
  • The client can use PKCE or a confidential backend.
  • Tokens must not appear in URLs or browser-accessible storage unnecessarily.

When Not To Use It

  • Machine-to-machine access needs client credentials.
  • A browser-only app cannot protect a client secret.
  • The app cannot validate issuer, audience, expiry, and scopes.

Main Benefits

  • Clarifies ownership and intent when the problem genuinely matches the pattern.
  • Improves testability by giving collaborators explicit roles.
  • Reduces duplication when repeated decisions are moved into one clear structure.

Trade-Offs

  • Adds names and indirection that must earn their keep.
  • Can make debugging harder if responsibilities are split without a clear boundary.
  • May be unnecessary when a direct function, class, or module is enough.

Common Mistakes

  • Applying the pattern because it is familiar instead of because the problem needs it.
  • Letting the pattern hide business rules, validation, authorization, or failure handling.
  • Creating abstractions before there are at least two real variations or a clear boundary.

Implementation Checklist

  • Name the problem this pattern is solving.
  • Keep the public API small and explicit.
  • Keep business rules in the owning layer, not in framework glue.
  • Prefer constructor injection over hidden globals.
  • Write tests around behavior and boundaries, not internal class structure.
  • Document the trade-off if the pattern adds visible indirection.

Example Implementation

browser -> authorization server -> authorization code -> backend exchanges code for tokens

Use authorization code with PKCE for public clients and keep tokens out of URLs.

Testing Strategy

  • Unit test the behavior that the pattern is meant to protect.
  • Add boundary tests for invalid inputs, failure paths, and edge cases.
  • Prefer fakes or in-memory adapters over mocking implementation details.
  • Add integration tests when the pattern crosses a framework, persistence, network, or deployment boundary.

Security Considerations

Use least privilege, validate issuer/audience/scope/expiry where tokens are involved, protect secrets in server-side stores, and never log credentials or bearer tokens.

Observability Considerations

Log authentication and authorization outcomes with correlation IDs and safe identifiers; emit metrics for denied requests, policy errors, and unusual token exchange or gateway behavior.

Platform Notes

  • Java/Spring Boot: Use dependency injection, small interfaces, and focused unit tests instead of static global access.
  • TypeScript/Frontend: Use typed interfaces, dependency injection where practical, and accessible UI states when the pattern affects presentation.
  • Kubernetes/Cloud: Keep platform concerns in configuration, infrastructure adapters, or deployment manifests rather than leaking them into domain logic.

Choosing Between Related Patterns

  • Use $luz-bff-token-handler when that pattern better matches the problem.
  • Use $luz-token-exchange when that pattern better matches the problem.
  • Use $luz-zero-trust-architecture when that pattern better matches the problem.

When not to use it

  • Machine-to-machine access needs client credentials
  • A browser-only app cannot protect a client secret
  • The app cannot validate issuer, audience, expiry, and scopes

Limitations

  • Adds names and indirection that must earn their keep
  • Can make debugging harder if responsibilities are split without a clear boundary
  • May be unnecessary when a direct function, class, or module is enough

How it compares

This flow uses an authorization code exchanged for tokens, preventing tokens from appearing in URLs or browser-accessible storage, unlike direct token issuance.

Compared to similar skills

luz-oauth2-authorization-code side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
luz-oauth2-authorization-code (this skill)02moNo flagsIntermediate
1password272moReviewIntermediate
security-compliance197moReviewAdvanced
information-security-manager-iso27001117moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

1password

openclaw

Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.

2799

security-compliance

davila7

Guides security professionals in implementing defense-in-depth security architectures, achieving compliance with industry frameworks (SOC2, ISO27001, GDPR, HIPAA), conducting threat modeling and risk assessments, managing security operations and incident response, and embedding security throughout the SDLC.

1981

information-security-manager-iso27001

davila7

Senior Information Security Manager specializing in ISO 27001 and ISO 27002 implementation for HealthTech and MedTech companies. Provides ISMS implementation, cybersecurity risk assessment, security controls management, and compliance oversight. Use for ISMS design, security risk assessments, control implementation, and ISO 27001 certification activities.

1169

cursor-sso-integration

jeremylongshore

Configure SSO and enterprise authentication in Cursor. Triggers on "cursor sso", "cursor saml", "cursor oauth", "enterprise cursor auth", "cursor okta". Use when working with cursor sso integration functionality. Trigger with phrases like "cursor sso integration", "cursor integration", "cursor".

433

springboot-security

affaan-m

Spring Security best practices for authn/authz, validation, CSRF, secrets, headers, rate limiting, and dependency security in Java Spring Boot services.

529

django-security

affaan-m

Django security best practices, authentication, authorization, CSRF protection, SQL injection prevention, XSS prevention, and secure deployment configurations.

522

Search skills

Search the agent skills registry