# token-management

> Claude/Codex skill by [@duendesoftware](https://omgskills.com/library/duendesoftware/index.md) · 9 stars · Updated 2026-10-16

Token management patterns using Duende.AccessTokenManagement. Covers client credential token caching, user token refresh, token storage, HttpClientFactory integration, DPoP support, and common configuration pitfalls. Also includes Blazor Server token management.

Tags: ai-agents, claude, claude-code

## Install

```sh
git clone https://github.com/DuendeSoftware/duende-skills /tmp/duende-skills && ln -s /tmp/duende-skills/skills/token-management ~/.claude/skills/token-management
```

## From README

Token Management When to Use This Skill Use this skill when: Building a .NET worker service or daemon that calls APIs using the client credentials flow Building an ASP.NET Core web application that calls APIs on behalf of the currently logged-in user Integrating Duende.AccessTokenManagement or Duende.AccessTokenManagement.OpenIdConnect with IHttpClientFactory Configuring token caching — in-memory, distributed (Redis), or hybrid — for machine-to-machine tokens Adding DPoP (Demonstrating Proof-of-Possession) key binding to access tokens Implementing API-to-API delegation where a downstream service calls further APIs with either user tokens or client credentials Revoking refresh tokens on user sign-out Core Principles Prefer Automatic Over Manual — Use IHttpClientFactory-integrated clients; they acquire, cache, refresh, and attach tokens transparently. Call GetAccessTokenAsync manually only when the factory pattern is insufficient. Never Cache Tokens in Code — The library owns the cache.

## Links

- HTML page: https://omgskills.com/library/duendesoftware/duende-skills/skills/token-management/
- GitHub: https://github.com/DuendeSoftware/duende-skills
- Author: [@duendesoftware](https://omgskills.com/library/duendesoftware/index.md)

## More from this repo

- [aspnetcore-authentication](https://omgskills.com/library/duendesoftware/duende-skills/skills/aspnetcore-authentication/index.md) — ASP.NET Core authentication middleware configuration including OpenID Connect, JWT Bearer, cookie authentication,...
   - [@duendesoftware](https://omgskills.com/library/duendesoftware/index.md) · 9 stars
- [aspnetcore-authorization](https://omgskills.com/library/duendesoftware/duende-skills/skills/aspnetcore-authorization/index.md) — ASP.NET Core authorization patterns including policy-based authorization, IAuthorizationHandler implementations,...
   - [@duendesoftware](https://omgskills.com/library/duendesoftware/index.md) · 9 stars
- [claims-authorization](https://omgskills.com/library/duendesoftware/duende-skills/skills/claims-authorization/index.md) — Claims transformation and profile service patterns for Duende IdentityServer — IProfileService, IClaimsTransformation,...
   - [@duendesoftware](https://omgskills.com/library/duendesoftware/index.md) · 9 stars
