---
title: "Sealed Client-Held OAuth Tokens for Workday AI — Kiweely"
description: "Central OAuth token databases turn AI gateways into high-value honeypots. See how AES-256-GCM sealed client-held tokens run Workday MCP with zero stored…"
url: https://kiweely.com/blog/sealed-client-held-oauth-tokens-stateless-workday-connectors
---

# Sealed Client-Held Tokens: Running a Workday AI Connector with Zero Stored Credentials

Traditional SaaS connectors store every employee’s Workday OAuth access and refresh tokens in a central database table. Encrypting each user-delegated Workday grant with AES-256-GCM inside the MCP client session token eliminates idle credential honeypots on the gateway server.

-   By Kiweely
-   November 15
-   6 min read

Most multi-tenant AI gateways pass user-delegated OAuth reviews only to introduce a second risk right behind them: a central `oauth_credentials` database table holding thousands of active Workday Bearer and refresh tokens at rest. **Sealed client-held tokens** eliminate that central honeypot by encrypting each employee’s user-delegated Workday OAuth grant with **AES-256-GCM** inside the session token carried by the MCP client itself—so an idle gateway server and its database hold zero Workday credentials.

When a security team evaluates an integration layer sitting in front of Workday HCM, Payroll, and Compensation, “encrypted at rest in RDS” still means a single SQL injection, leaked snapshot, or compromised support credential exposes active tokens for every connected executive, HR Partner, and payroll admin at once. Changing *where* the encrypted grant lives changes the blast radius completely.

## The Central Token Vault Problem in Traditional Integration Gateways

In a conventional SaaS integration broker, OAuth 2.0 works like this:

1.  An employee signs in to Workday via [Authorization Code Grant with PKCE](https://kiweely.com/guides/workday-api-client-pkce-sso-without-workday-password).
2.  Workday’s token endpoint returns an `access_token` (and optionally a `refresh_token`) scoped to the API Client’s Functional Areas and the employee’s Workday security groups.
3.  The broker generates a random session ID (`sess_98a1...`), hands `sess_98a1...` to the AI assistant’s MCP OAuth client, and writes `(sess_98a1, tenant_id, user_id, workday_access_token, workday_refresh_token)` into a central PostgreSQL or Redis store.

That table becomes the single highest-value target in the vendor’s cloud. Even when the vendor uses disk encryption or column-level envelope encryption, the gateway application tier has standing network access to both the database rows and the decryption key 24 hours a day. An attacker who compromises a background job or reads the token table can silently query `GET /common/v1/workers` or custom RaaS reports as every HR Partner and executive in your tenant—even for employees who haven’t opened chat in days.

## How AES-256-GCM Sealed Client-Held Tokens Work

The Model Context Protocol (`MCP`) specification already requires remote MCP clients (Claude Desktop, Claude Web, ChatGPT, Gemini) to store and transmit an `Authorization: Bearer <mcp_token>` header on every tool request made by that specific authenticated user.

Instead of storing the Workday OAuth grant in a server database and putting a lookup pointer in `<mcp_token>`, a stateless gateway turns `<mcp_token>` into a **cryptographically sealed envelope**:

text

```
MCP Bearer Token = version || key_id || 96-bit nonce || AES-256-GCM(plaintext_grant, AAD) || 128-bit auth_tag
```

Here is what happens at each step of the cryptographic lifecycle:

### 1\. Sign-In and Sealing (Authorization Code + PKCE)

-   The employee completes SSO and MFA directly on Workday’s own sign-in screen in the browser. The gateway never sees the employee’s Workday password or MFA factor.
-   The gateway redeems the authorization code + PKCE `code_verifier` with Workday’s token endpoint in memory.
-   Immediately in RAM, the gateway constructs a compact binary payload containing the Workday grant, expiry timestamp, and tenant binding, then seals it with **AES-256-GCM** using Additional Authenticated Data (`AAD`) binding the `tenant_id`, `client_id`, and `policy_epoch`.
-   The gateway returns this opaque sealed token to the employee’s MCP client and zeroes the plaintext buffer. Nothing is written to a database or disk.

### 2\. Per-Request Ephemeral Unsealing

When the employee asks a question in Claude, ChatGPT, or Gemini:

1.  The AI assistant’s MCP client sends `Authorization: Bearer <sealed_token>` over TLS 1.3 to the gateway. (Note that the LLM itself never sees the `Authorization` HTTP transport header—the host MCP client injects it at the network layer.)
2.  The gateway verifies the 128-bit GCM authentication tag and `AAD` binding in memory. Any single-bit tampering, cross-tenant replay, or expired `policy_epoch` fails decryption before any upstream socket opens.
3.  The gateway unseals the Workday Bearer grant in process memory for the 100–300 milliseconds required to call Workday’s REST, WQL, SOAP, or RaaS endpoint, strips any admin-redacted fields from the response, streams the answer back, and drops the request buffer.

### 3\. Zero Credentials at Rest When Idle

The moment the HTTP response finishes streaming, **zero copies of the employee’s Workday credential exist anywhere on the gateway**. Database backups contain only tenant URLs, tool enablement policies, and payload-free call counts.

## Architectural Comparison: Central Token Vault vs. Sealed Client-Held Grants

| Security Property | Central Database Token Vault | Sealed Client-Held Token (AES-256-GCM) |
| --- | --- | --- |
|  **Database breach / SQL snapshot leak** | Exposes all active employee & HR Partner tokens at once | Database contains **zero** employee tokens |
|  **Idle gateway server memory** | Background refresh workers load dormant user grants | Idle workers hold **zero** customer credentials |
|  **Visibility to AI assistant / LLM** | Opaque reference ID | Opaque AES-256-GCM ciphertext; assistant **cannot decrypt** |
|  **Tamper resistance** | Relies on DB row integrity | 128-bit GCM authentication tag + `AAD` tenant binding |
|  **Horizontal & multi-region scaling** | Requires replicated, low-latency session/token DB | Completely stateless across regions and self-hosted VPCs |
|  **Self-hosted deployment footprint** | Requires customer IT to run & back up a stateful DB | Single stateless container (`volumes: []`, zero DB) |

## Defense in Depth: Pairing Sealed Tokens with Workday IP Restrictions

What if InfoSec asks the next adversarial question: *“What if the gateway’s KMS key were compromised AND an attacker intercepted a live request?”*

Workday gives administrators a native second lock that binds OAuth token usability to a specific network perimeter:

1.  Run the **Maintain IP Ranges** task in Workday and register the dedicated static outbound IPv4 CIDR of your gateway instance (or your own VPC NAT Gateway if self-hosting).
2.  Open **Manage Authentication Policies** in Workday, add an authentication rule scoped to your API Client’s users or conditions, and restrict allowed API authentication to that IP range.
3.  Activate the authentication policy changes (always test in Sandbox first with a break-glass admin session exempted so you do not [trigger 401 or invalid\_grant lockouts](https://kiweely.com/guides/workday-isu-authentication-errors)).

With both controls active, stealing the ciphertext from a client laptop is useless without the gateway’s AES-256-GCM key, compromising a database yields zero tokens because no token table exists, and even a raw Workday token cannot be replayed from outside the allowlisted static egress IP.

## Handling Token Expiry and Instant Revocation Without a Token Table

Stateless token sealing does not sacrifice administrative revocation:

-   **Short-lived Workday access tokens:** Workday enforces the access token TTL configured on `Register API Client`. When a token expires or an employee terminates in Workday, Workday immediately rejects upstream calls with `401 Unauthorized`.
-   **Epoch-based instant cutover:** By storing a lightweight integer `revocation_epoch` on the tenant’s configuration record (no credentials, just a counter), an IT admin can invalidate every active MCP session across the company in one click—changing the `AAD` epoch so all older sealed envelopes fail GCM verification instantly without touching Workday’s `Register API Client` configuration.

## How Kiweely Bridge Implements Sealed Client-Held Tokens

[Kiweely Bridge](https://kiweely.com/bridge) (coming next) uses this exact zero-credential-storage design across every deployment tier ([see the full trust matrix on `/bridge/security`](https://kiweely.com/bridge/security)):

-   **Zero token table:** Bridge keeps no database table of employee Workday tokens. Each user-delegated `Register API Client` (Authorization Code + PKCE) grant is sealed with AES-256-GCM and carried by the MCP client in Claude, ChatGPT, or Gemini.
-   **Opaque to AI vendors:** The AI assistant holds only the sealed session token and cannot read the Workday credential inside.
-   **Three deployment modes:** Run on **Kiweely Cloud** ($499/mo up to 1,000 Workday employees, $1,499/mo for 1,001–5,000, $3,999/mo for 5,001–20,000, unlimited calls, covering Production and all Sandbox/implementation tenants; free for one person on a personal Workday developer tenant), **Dedicated single-tenant** with a static outbound IP for Workday `Maintain IP Ranges`, or **Self-hosted stateless container** inside your own AWS, GCP, Azure, or Kubernetes perimeter (Enterprise by quote).

## Frequently asked questions

### Can Claude, ChatGPT, or Gemini read the Workday OAuth token inside a sealed session token?

No. The MCP client holds an opaque ciphertext sealed with AES-256-GCM using a key managed only by the gateway's KMS/HSM boundary. Neither the AI model nor the AI vendor's server can decrypt the underlying Workday Bearer credential.

### What happens if an attacker compromises an idle stateless gateway worker or database backup?

There is no oauth\_tokens database table to dump, and an idle worker process holds zero employee Workday tokens in RAM. Without an active incoming request presenting a valid sealed envelope, no customer credentials exist on the server.

### How do IP allowlists reinforce sealed client-held tokens?

By registering the gateway's dedicated static outbound IP in Workday's Maintain IP Ranges task and binding it in Manage Authentication Policies, even a hypothetically extracted Workday token is rejected by Workday if replayed from any other network.

### How does an employee or admin revoke access when tokens are client-held?

Revocation works at two independent layers: deactivating the worker's session or OAuth token in Workday immediately causes upstream API calls to return 401 invalid\_grant, and incrementing the tenant or user key-epoch metadata on the gateway immediately invalidates previously sealed envelopes.

## Read next

[All posts](https://kiweely.com/blog)

-   [November 15 ### Launching Stripped-Down Workday Screens for Seasonal Retail and Contingent Workforces](https://kiweely.com/blog/seasonal-and-contingent-worker-workday-screens-fast-rollout)
-   [November 15 ### Running a Stateless Workday MCP Container Inside Your Own AWS, GCP, or Azure VPC](https://kiweely.com/blog/self-hosting-stateless-workday-mcp-connector-aws-gcp-azure)
-   [November 15 ### Personal Phone App vs. Shared Warehouse Kiosk for Workday Frontline Self-Service](https://kiweely.com/blog/shared-tablet-and-kiosk-considerations-for-workday-frontline)

### More guides on More Workday guides

[All 46 guides](https://kiweely.com/guides#more)

-   [How Workday Data Conversion Works, and Why It Takes So Many Loads](https://kiweely.com/guides/ai-workday-data-conversion-mapping)
-   [Pre-Hire Windows That Create Directory Users Before Anyone Is Hired](https://kiweely.com/guides/pre-hire-windows-that-create-directory-users-early)
-   [Why Workday to Microsoft Entra Incremental Sync Misses Changes](https://kiweely.com/guides/why-workday-to-entra-incremental-sync-misses-changes)
-   [Remap Workday Benefit Codes When a Carrier Companion Guide Changes](https://kiweely.com/guides/remap-workday-834-codes-after-companion-guide-change)
-   [Full File or Changes-Only 834 After Workday Open Enrollment](https://kiweely.com/guides/workday-834-full-file-or-changes-only-after-open-enrollment)
-   [Match Workday People to Okta on the ID That Survives the Job Change](https://kiweely.com/guides/match-workday-workers-to-okta-on-the-right-id)
-   [Why a Delivered Workday File Was Still Rejected](https://kiweely.com/guides/workday-file-delivered-carrier-rejected-rows)
-   [Scoping AI Workday Access for Contingent Workers and Alumni](https://kiweely.com/guides/scoping-ai-workday-access-contingent-workers-alumni)

## Your Workday work, done by AI.

Kiweely Vine is the AI agent that builds, deploys and tests Extend apps as real people, makes changes in any Workday task screen, answers from your real tenant and builds reports.

[Start for free](https://kiweely.com/download) [See how it works](https://kiweely.com/vine/how-it-works)

## Get the next one in your inbox.

One email a month for Workday teams: what’s changing in Workday and what to retest, one tip tried in a real tenant, and what’s new at Kiweely.
