MCPcopy Index your code
hub / github.com/simstudioai/sim / getMissingRequiredScopes

Function getMissingRequiredScopes

apps/sim/lib/oauth/utils.ts:566–584  ·  view source on GitHub ↗
(
  credential: { scopes?: string[] } | undefined,
  requiredScopes: string[] = []
)

Source from the content-addressed store, hash-verified

564 * as they are not returned in the token response's scope list even when granted.
565 */
566export function getMissingRequiredScopes(
567 credential: { scopes?: string[] } | undefined,
568 requiredScopes: string[] = []
569): string[] {
570 if (!credential) {
571 return requiredScopes.filter((s) => !IGNORED_SCOPES.has(s))
572 }
573
574 const granted = new Set(credential.scopes || [])
575 const missing: string[] = []
576
577 for (const s of requiredScopes) {
578 if (IGNORED_SCOPES.has(s)) continue
579
580 if (!granted.has(s)) missing.push(s)
581 }
582
583 return missing
584}
585
586/**
587 * Build a mapping of providerId -> { baseProvider, serviceKey } from OAUTH_PROVIDERS

Callers 4

utils.test.tsFile · 0.90
ConnectorCardFunction · 0.90
ToolCredentialSelectorFunction · 0.90
CredentialSelectorFunction · 0.90

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected