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

Function recordedOAuthScope

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

Source from the content-addressed store, hash-verified

318};
319
320const recordedOAuthScope = (
321 token: OAuth2TokenResponse,
322 requestedScopes: readonly string[],
323): string | null => {
324 if (token.scope == null) return requestedScopes.join(" ") || null;
325
326 const granted = token.scope.split(/\s+/).filter(Boolean);
327 const coveredByRefreshToken =
328 token.refresh_token && requestedScopes.includes("offline_access") ? ["offline_access"] : [];
329 const recorded = dedupeScopes([...granted, ...coveredByRefreshToken]);
330 return recorded.join(" ") || null;
331};
332
333const OAUTH_SCOPE_ALIASES: Readonly<Record<string, string>> = {
334 "https://www.googleapis.com/auth/userinfo.email": "email",

Callers 1

mintFromTokenFunction · 0.85

Calls 1

dedupeScopesFunction · 0.85

Tested by

no test coverage detected