Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/provider-owned-oauth-refresh-grant.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@executor-js/sdk": minor
---

`CredentialProvider` gains an optional `refreshGrant`. When a provider implements it, Executor asks it to perform the OAuth refresh exchange instead of asking it for the refresh token: the provider spends the token, seals the newly minted access token (and a rotated refresh token, if the authorization server sent one) under the same item ids, and reports only the granted lifetime and scope. Executor re-validates that metadata, reads the access token back through `get` like any other credential, and never resolves the refresh token or the client secret on that path.

A refused grant comes back as `RefreshGrantRejected` carrying a closed standards-defined token-endpoint code, so a delegated refusal classifies re-authentication, surfaces `invalid_grant` to the caller, and arms the known-dead gate exactly as a host-side refusal does. Providers that do not implement `refreshGrant` are unaffected, and so are the grants that have no refresh token to delegate.
396 changes: 346 additions & 50 deletions packages/core/sdk/src/executor.ts

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion packages/core/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,18 @@ export type {
} from "./connection";
export type { Tool, ToolDef, ToolListFilter, ToolAnnotations } from "./tool";
// Credential providers.
export type { CredentialProvider, ProviderEntry } from "./provider";
export {
MAX_REFRESH_GRANT_EXPIRES_IN_SECONDS,
RefreshGrantRejected,
isRefreshGrantRejectionCode,
} from "./provider";
export type {
CredentialProvider,
ProviderEntry,
RefreshGrantInput,
RefreshGrantRejectionCode,
RefreshGrantResult,
} from "./provider";

// Public projections / detection.
export { ToolSchemaView, ToolAnnotationsView, IntegrationDetectionResult } from "./types";
Expand Down
Loading
Loading