dotnet-api-auth

Implement JWT Bearer and API key authentication for ASP.NET Core Web APIs.

1|1|Updated Jan 15, 2026
One-click install
npx skills add https://github.com/medride/claude-code-research --skill dotnet-api-auth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-api-auth
Source: https://github.com/medride/claude-code-research/tree/main/.claude/skills/dotnet-api-auth
Command: npx skills add https://github.com/medride/claude-code-research --skill dotnet-api-auth

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Authentication and authorization for ASP.NET Core Web APIs, consolidating common patterns (JWT, API keys, policies) to simplify securing endpoints and resources.

Core Features & Use Cases

  • JWT Bearer authentication with issuer, audience, and key validation
  • API Key authentication via middleware
  • Policy-based authorization with roles and claims
  • Resource-based authorization with custom handlers and endpoint guards
  • Claims, roles, and token generation for protected APIs
  • CORS configuration to support cross-origin API access

Quick Start

Configure the JWT authentication in Program.cs and register authorization, then protect endpoints using policies.

Frequently Asked Questions about dotnet-api-auth

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I secure an ASP.NET Core Web API using JWT Bearer authentication?

JWT Bearer authentication secures ASP.NET Core APIs by validating issuer, audience, and cryptographic keys. This pattern protects endpoints by requiring valid tokens, handling claims, and enforcing role checks before granting access to protected resources.

What is resource-based authorization in ASP.NET Core and when should I use it?

Resource-based authorization controls access by evaluating specific data resources against user claims using custom handlers. Use this pattern when policy-based role checks are insufficient and you need per-resource access control to restrict endpoint actions.

Can I use API key authentication via middleware to protect my ASP.NET Core API?

Yes, API key authentication can be implemented via middleware to secure ASP.NET Core APIs. This approach intercepts requests, validates the provided API key, and authorizes access, offering an alternative to JWT for service-to-service or client integrations.

How do I configure CORS and policy-based authorization in an ASP.NET Core API?

Configure CORS to support cross-origin API access and register policy-based authorization in Program.cs. Policies enforce access using roles and claims, applying endpoint guards to ensure only authorized users reach protected API routes.

What is the best way to generate tokens and handle claims for protected APIs?

The best way to handle claims for protected APIs is generating JWT tokens that encapsulate user roles and specific claim data. This allows ASP.NET Core authorization handlers to validate tokens and enforce custom policy conditions securely.