ππ Agent
Chapter 8 / 21

Auth & OAuth

Provider-owned credentials & OAuth flows

Stored credential beats env; failed refresh never silently falls back

Key Source Files

ai/src/auth/{types,credential-store,resolve}.ts
auth/oauth/anthropic.ts (350)
openai-codex.ts (538)
pkce.ts
Total size ~ ~85KB

Run Demo

# Directly runnable
$ cd Pi-Agent-Site
$ npx tsx agents/s08_auth_oauth.ts