---
title: "Discussion on \"The agent fetched the access token once at boot and cached it forever, so rotation broke the app hours later\" | Hashnode"
description: "Discussion on \"The agent fetched the access token once at boot and cached it forever, so rotation broke the app hours later\". The agent fetched a client-credentials token once at startup, cached it for the process lifetime, and never modeled expiry. Stubbed tests passed, the deploy was clean, and an hour later calls returned 401 until a restart. A short-lived token was treated as a static key."
url: "https://hashnode.com/posts/agent-cached-access-token-forever-no-refresh/6ade782ec8673eff918f1aaf"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [The agent fetched the access token once at boot and cached it forever, so rotation broke the app hours later](https://blogs.powerduck.com/agent-cached-access-token-forever-no-refresh?utm_source=hashnode&utm_medium=feed)

The agent fetched a client-credentials token once at startup, cached it for the process lifetime, and never modeled expiry. Stubbed tests passed, the deploy was clean, and an hour later calls returned 401 until a restart. A short-lived token was treated as a static key.

Oct 25 · 3 min read · blogs.powerduck.com  
Read the article

-   [#aiagents](https://hashnode.com/tag/aiagents)
-   [#aicode](https://hashnode.com/tag/aicode)
-   [#security](https://hashnode.com/tag/security)
-   [#devops](https://hashnode.com/tag/devops)

## Written by

[Powerduck](https://hashnode.com/@powerduck)

@powerduck · hon

  
[View profile](https://hashnode.com/@powerduck)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
