MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / recordedOAuthScope

Function recordedOAuthScope

packages/core/sdk/src/oauth-service.ts:195–206  ·  view source on GitHub ↗
(
  token: OAuth2TokenResponse,
  requestedScopes: readonly string[],
)

Source from the content-addressed store, hash-verified

193};
194
195const recordedOAuthScope = (
196 token: OAuth2TokenResponse,
197 requestedScopes: readonly string[],
198): string | null => {
199 if (token.scope == null) return requestedScopes.join(" ") || null;
200
201 const granted = token.scope.split(/\s+/).filter(Boolean);
202 const coveredByRefreshToken =
203 token.refresh_token && requestedScopes.includes("offline_access") ? ["offline_access"] : [];
204 const recorded = dedupeScopes([...granted, ...coveredByRefreshToken]);
205 return recorded.join(" ") || null;
206};
207
208const OAUTH_SCOPE_ALIASES: Readonly<Record<string, string>> = {
209 "https://www.googleapis.com/auth/userinfo.email": "email",

Callers 1

mintFromTokenFunction · 0.85

Calls 1

dedupeScopesFunction · 0.85

Tested by

no test coverage detected