(
credential: { scopes?: string[] } | undefined,
requiredScopes: string[] = []
)
| 564 | * as they are not returned in the token response's scope list even when granted. |
| 565 | */ |
| 566 | export 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 |
no test coverage detected