History

Launch built-in Google OAuth for Calendar and Sheets

Rhys Sullivan committed 2 months ago

Commit ac3bea51 parent 67ee8a013 files · +313 −10Browse files

Showing the changes to packages/plugins/openapi/src (2 of 13 files). Show all

Unified · Split

2 files
  1. packages/plugins/openapi/src/providers/google/index.ts +1 −0
  2. packages/plugins/openapi/src/providers/google/presets.ts +9 −4
packages/plugins/openapi/src/providers/google/index.ts+1−0
@@ -17,6 +17,7 @@ export { · 16 unmodified lines
1717 googleStandardUserOAuthPresets,
1818 googleOAuthConsentScopes,
1919 googleOAuthConsentScopesForPreset,
20+ googleCatalogOAuthScopesForPreset,
2021 googleServiceSlug,
2122 googleAudienceWarningsForUrls,
2223 googlePresetForDiscoveryUrl,
packages/plugins/openapi/src/providers/google/presets.ts+9−4
@@ -317,16 +317,21 @@ const GOOGLE_HEALTH_CHECKS: Readonly<Record<string, HealthCheckSpec>> = { · 316 unmodified lines
317317 "google-cloud-resource-manager": { operation: "cloudresourcemanager.projects.list" },
318318 };
319319
320+/** Complete Google OAuth scope set requested by a catalog preset, including
321+ * identity scopes used to label and distinguish connected accounts. */
322+export const googleCatalogOAuthScopesForPreset = (presetId: string): readonly string[] =>
323+ compactGoogleOAuthScopes([
324+ ...GOOGLE_IDENTITY_SCOPES,
325+ ...googleOAuthConsentScopesForPreset(presetId),
326+ ]);
327+
320328 const googleCatalogAuthTemplate = (presetId: string) => [
321329 {
322330 slug: GOOGLE_OAUTH_SECURITY_SCHEME,
323331 kind: "oauth2" as const,
324332 authorizationUrl: GOOGLE_OAUTH_AUTHORIZATION_URL,
325333 tokenUrl: GOOGLE_OAUTH_TOKEN_URL,
326− scopes: compactGoogleOAuthScopes([
327− ...GOOGLE_IDENTITY_SCOPES,
328− ...googleOAuthConsentScopesForPreset(presetId),
329− ]),
334+ scopes: googleCatalogOAuthScopesForPreset(presetId),
330335 },
331336 ];
332337

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t