# Platform Oauth Linked Billing Workflow

> Let customers link their own AI platform billing accounts via passwordless PAR/PKCE OAuth and ES256 JWTs so user-triggered runs charge their org directly.

Platform Oauth Linked Billing Workflow is a paid AI agent skill on Agensi by Sheeyassh. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $4 (one-time purchase)
- Creator: [Sheeyassh](https://www.agensi.io/creators/s1reyash)
- Version: 1.0.0
- Last updated: 2026-12-02
- Security: scan passed (2026-12-02); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/platform-oauth-linked-billing-workflow
- Tags: code-quality-review, oauth2, pkce, linked-billing, es256-jwt

## About this skill

Let customers link their own AI platform billing accounts via passwordless PAR/PKCE OAuth and ES256 JWTs so user-triggered runs charge their org directly. This skill guides AI coding agents through implementing AI platform OAuth with customer-linked billing, enabling end users to connect their own Console organization so user-initiated AI calls bill directly to them. It enforces passwordless ES256 JWT client assertions, PAR/PKCE flows, encrypted rotating refresh tokens, and strict cost/secret boundaries across your chosen backend stack.

### What it does
- **Linked-Billing Security & Flow Audit** Review existing user models, OAuth callbacks, and AI proxy routes to verify ES256 assertion signing, encrypted rotating refresh-token persistence, secret isolation, and cost-guard enforcement.
- **Token Rotation & Production Hardening** Fix token-rotation race conditions, enforce `max_tokens` and UI cost previews, or prepare Testing-mode apps for production by stripping `localhost` redirects and verifying DNS TXT rules.
- **Greenfield Platform OAuth Implementation** Plan and implement end-to-end PAR/PKCE OAuth, ES256 key generation (`genkey.mjs`), encrypted per-user credential storage, and verified Console integration from scratch.
- **Deterministic Deliverables** Every run produces a stack-tailored integration plan, ES256 key-generation and verification scripts, PAR/PKCE OAuth backend endpoints with encrypted atomic token rotation, cost-capped user-run handlers, and a Console go-live checklist.

### How it works
1. **Pre-Flight & Scope Audit** verifies workspace boundaries, inputs, and required tools (`filesystem-read`, `filesystem-write`, `git`, `node`) before modifying any files.
2. **Core Workflow Execution** runs **Linked-Billing Security & Flow Audit**, **Token Rotation & Production Hardening** using modular, non-destructive steps.
3. **Quality Gate Enforcement** applies skill-specific checks including *Atomic Commit Hygiene & Safe History Verification*, *OAuth2 PKCE & Token Lifecycle Hardening*.
4. **Verification & Reporting** validates every deliverable against the 7-point checklist and emits an evidence-backed summary.

### Frameworks & tools
Supports `aws`, `bash`, `cloudflare`, `django`, `gcp`, `git`. Uses agent tools: `filesystem-read`, `filesystem-write`, `git`, `node`, `python3`, `shell-exec`. Prerequisites: AI platform Console access, Node.js for key & verify scripts, HTTPS redirect URI. Compatible with Claude Code, Cursor, Windsurf, Antigravity, Codex CLI, and MCP-enabled agents.

### Why this beats prompting it yourself
Building linked-billing OAuth by hand often fails on subtle protocol rules—inventing non-existent client secrets, dropping rotated refresh tokens under concurrency, or leaking operator credentials into client logs. The skill inspects your repo's manifests (`package.json`, `pyproject.toml`, `go.mod`, etc.) first to tailor crypto, database locking, and routing to your stack, backed by `genkey.mjs` and `verify.mjs` checks. Instead of ad-hoc prompting, Platform Oauth Linked Billing Workflow enforces Atomic Commit Hygiene & Safe History Verification, OAuth2 PKCE & Token Lifecycle Hardening, Architecture Modularity & Automated Regression Gate alongside a deterministic 7-point verification checklist.

### Use cases
- Building a "Connect your AI org" BYO-billing button in SaaS developer tools so AI usage bills directly to each customer's Console organization.
- Migrating risky user-pasted API key inputs to secure, revocable PAR/PKCE OAuth connections with rotating refresh tokens.
- Hardening concurrent refresh-token handling and adding mandatory pre-run cost previews and `max_tokens` caps before shipping.
- Preparing a Testing-mode linked-billing app for public review by auditing secret leakage, removing `localhost` redirect URIs, and verifying DNS TXT setup.

### Known limitations
Apps start in Testing mode limited to allowlisted test users (capped at USD 50/month each); lifting limits requires DNS TXT domain verification and platform review. Console registration steps (adding inline JWKs, test users, and archiving test issuers) require manual actions by the developer in the platform web Console. Unattended cron or background batch jobs are intentionally excluded from linked-billing flows without separate explicit customer-approved authorization mechanisms.

## Requires

- AI platform Console access
- Node.js for key & verify scripts
- HTTPS redirect URI
- Node.js

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Platform Oauth Linked Billing Workflow skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How does this differ from generic OAuth 2.0 implementation help?

Standard OAuth guides assume static client secrets and non-rotating tokens. This skill implements the exact passwordless ES256 client-assertion + PAR/PKCE + rotating refresh-token architecture required for AI platform linked billing.

### Which languages and cloud environments are supported?

It supports Node.js/TypeScript, Python (Django/FastAPI), Go, and Ruby/PHP backends across AWS, GCP, and Cloudflare runtimes, pairing bundled `genkey.mjs` and `verify.mjs` helpers with your stack's crypto and ORM libraries.

### What deliverables does the skill produce?

You get an inspected implementation plan, ES256 keypair generation, PAR/PKCE authorize and callback routes, encrypted rotating token storage, cost-capped inference wrappers, and a go-live Console verification checklist.

### What prerequisites apply, and can it audit an existing integration?

You need access to the AI platform Console to register the issuer and test users; you can run it both for greenfield "Connect your AI org" features and to audit existing token-rotation or redirect-URI security gaps.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
