From e9e2c6f0fa35f46b468c1533e130fe50d5c5b0d3 Mon Sep 17 00:00:00 2001 From: Adam Gough Date: Thu, 2 Oct 2025 12:55:03 -0700 Subject: [PATCH 1/2] added google forms scope and google drive scope --- .../components/oauth-required-modal.tsx | 3 ++- apps/sim/blocks/blocks/google_docs.ts | 2 +- apps/sim/blocks/blocks/google_drive.ts | 8 ++++---- apps/sim/lib/auth.ts | 6 +++--- apps/sim/lib/oauth/oauth.ts | 6 +++--- apps/sim/tools/google_docs/create.ts | 2 +- apps/sim/tools/google_docs/read.ts | 2 +- apps/sim/tools/google_docs/write.ts | 2 +- apps/sim/tools/google_drive/create_folder.ts | 2 +- apps/sim/tools/google_drive/get_content.ts | 2 +- apps/sim/tools/google_drive/list.ts | 2 +- apps/sim/tools/google_drive/upload.ts | 2 +- 12 files changed, 20 insertions(+), 19 deletions(-) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/credential-selector/components/oauth-required-modal.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/credential-selector/components/oauth-required-modal.tsx index eb9df9cb67..8d0744f22e 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/credential-selector/components/oauth-required-modal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/credential-selector/components/oauth-required-modal.tsx @@ -38,11 +38,12 @@ const SCOPE_DESCRIPTIONS: Record = { 'https://www.googleapis.com/auth/gmail.modify': 'View and manage your email messages', // 'https://www.googleapis.com/auth/gmail.readonly': 'View and read your email messages', // 'https://www.googleapis.com/auth/drive': 'View and manage your Google Drive files', - 'https://www.googleapis.com/auth/drive.file': 'View and manage your Google Drive files', + 'https://www.googleapis.com/auth/drive.readonly': 'View and read your Google Drive files', // 'https://www.googleapis.com/auth/documents': 'View and manage your Google Docs', 'https://www.googleapis.com/auth/calendar': 'View and manage your calendar', 'https://www.googleapis.com/auth/userinfo.email': 'View your email address', 'https://www.googleapis.com/auth/userinfo.profile': 'View your basic profile info', + 'https://www.googleapis.com/auth/forms.responses.readonly': 'View responses to your Google Forms', 'read:page:confluence': 'Read Confluence pages', 'write:page:confluence': 'Write Confluence pages', 'read:me': 'Read your profile information', diff --git a/apps/sim/blocks/blocks/google_docs.ts b/apps/sim/blocks/blocks/google_docs.ts index f023bdfe30..a74a0c2639 100644 --- a/apps/sim/blocks/blocks/google_docs.ts +++ b/apps/sim/blocks/blocks/google_docs.ts @@ -37,7 +37,7 @@ export const GoogleDocsBlock: BlockConfig = { required: true, provider: 'google-docs', serviceId: 'google-docs', - requiredScopes: ['https://www.googleapis.com/auth/drive.file'], + requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'], placeholder: 'Select Google account', }, // Document selector (basic mode) diff --git a/apps/sim/blocks/blocks/google_drive.ts b/apps/sim/blocks/blocks/google_drive.ts index 718a9f6644..c877044086 100644 --- a/apps/sim/blocks/blocks/google_drive.ts +++ b/apps/sim/blocks/blocks/google_drive.ts @@ -36,7 +36,7 @@ export const GoogleDriveBlock: BlockConfig = { required: true, provider: 'google-drive', serviceId: 'google-drive', - requiredScopes: ['https://www.googleapis.com/auth/drive.file'], + requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'], placeholder: 'Select Google Drive account', }, // Upload Fields @@ -80,7 +80,7 @@ export const GoogleDriveBlock: BlockConfig = { canonicalParamId: 'folderId', provider: 'google-drive', serviceId: 'google-drive', - requiredScopes: ['https://www.googleapis.com/auth/drive.file'], + requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'], mimeType: 'application/vnd.google-apps.folder', placeholder: 'Select a parent folder', mode: 'basic', @@ -156,7 +156,7 @@ export const GoogleDriveBlock: BlockConfig = { canonicalParamId: 'folderId', provider: 'google-drive', serviceId: 'google-drive', - requiredScopes: ['https://www.googleapis.com/auth/drive.file'], + requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'], mimeType: 'application/vnd.google-apps.folder', placeholder: 'Select a parent folder', mode: 'basic', @@ -183,7 +183,7 @@ export const GoogleDriveBlock: BlockConfig = { canonicalParamId: 'folderId', provider: 'google-drive', serviceId: 'google-drive', - requiredScopes: ['https://www.googleapis.com/auth/drive.file'], + requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'], mimeType: 'application/vnd.google-apps.folder', placeholder: 'Select a folder to list files from', mode: 'basic', diff --git a/apps/sim/lib/auth.ts b/apps/sim/lib/auth.ts index 5dd170ad91..f5a20cf261 100644 --- a/apps/sim/lib/auth.ts +++ b/apps/sim/lib/auth.ts @@ -425,7 +425,7 @@ export const auth = betterAuth({ scopes: [ 'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile', - 'https://www.googleapis.com/auth/drive.file', + 'https://www.googleapis.com/auth/drive.readonly', ], prompt: 'consent', redirectURI: `${env.NEXT_PUBLIC_APP_URL}/api/auth/oauth2/callback/google-drive`, @@ -439,7 +439,7 @@ export const auth = betterAuth({ scopes: [ 'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile', - 'https://www.googleapis.com/auth/drive.file', + 'https://www.googleapis.com/auth/drive.readonly', ], prompt: 'consent', redirectURI: `${env.NEXT_PUBLIC_APP_URL}/api/auth/oauth2/callback/google-docs`, @@ -453,7 +453,7 @@ export const auth = betterAuth({ scopes: [ 'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile', - 'https://www.googleapis.com/auth/drive.file', + 'https://www.googleapis.com/auth/drive.readonly', ], prompt: 'consent', redirectURI: `${env.NEXT_PUBLIC_APP_URL}/api/auth/oauth2/callback/google-sheets`, diff --git a/apps/sim/lib/oauth/oauth.ts b/apps/sim/lib/oauth/oauth.ts index 803100b752..6896c9ed29 100644 --- a/apps/sim/lib/oauth/oauth.ts +++ b/apps/sim/lib/oauth/oauth.ts @@ -121,7 +121,7 @@ export const OAUTH_PROVIDERS: Record = { providerId: 'google-drive', icon: (props) => GoogleDriveIcon(props), baseProviderIcon: (props) => GoogleIcon(props), - scopes: ['https://www.googleapis.com/auth/drive.file'], + scopes: ['https://www.googleapis.com/auth/drive.readonly'], }, 'google-docs': { id: 'google-docs', @@ -130,7 +130,7 @@ export const OAUTH_PROVIDERS: Record = { providerId: 'google-docs', icon: (props) => GoogleDocsIcon(props), baseProviderIcon: (props) => GoogleIcon(props), - scopes: ['https://www.googleapis.com/auth/drive.file'], + scopes: ['https://www.googleapis.com/auth/drive.readonly'], }, 'google-sheets': { id: 'google-sheets', @@ -139,7 +139,7 @@ export const OAUTH_PROVIDERS: Record = { providerId: 'google-sheets', icon: (props) => GoogleSheetsIcon(props), baseProviderIcon: (props) => GoogleIcon(props), - scopes: ['https://www.googleapis.com/auth/drive.file'], + scopes: ['https://www.googleapis.com/auth/drive.readonly'], }, 'google-forms': { id: 'google-forms', diff --git a/apps/sim/tools/google_docs/create.ts b/apps/sim/tools/google_docs/create.ts index 4f025f4d79..008652dcf4 100644 --- a/apps/sim/tools/google_docs/create.ts +++ b/apps/sim/tools/google_docs/create.ts @@ -13,7 +13,7 @@ export const createTool: ToolConfig oauth: { required: true, provider: 'google-docs', - additionalScopes: ['https://www.googleapis.com/auth/drive.file'], + additionalScopes: ['https://www.googleapis.com/auth/drive.readonly'], }, params: { diff --git a/apps/sim/tools/google_docs/write.ts b/apps/sim/tools/google_docs/write.ts index 51b5bcb34a..4acf3b1cda 100644 --- a/apps/sim/tools/google_docs/write.ts +++ b/apps/sim/tools/google_docs/write.ts @@ -9,7 +9,7 @@ export const writeTool: ToolConfig Date: Sat, 25 Oct 2025 00:47:45 -0700 Subject: [PATCH 2/2] added back file scope --- .../components/oauth-required-modal.tsx | 1 + apps/sim/blocks/blocks/google_docs.ts | 5 ++++- apps/sim/blocks/blocks/google_drive.ts | 20 +++++++++++++++---- apps/sim/lib/auth.ts | 3 +++ apps/sim/lib/oauth/oauth.ts | 15 +++++++++++--- apps/sim/tools/google_docs/create.ts | 5 ++++- apps/sim/tools/google_docs/read.ts | 5 ++++- apps/sim/tools/google_docs/write.ts | 5 ++++- apps/sim/tools/google_drive/create_folder.ts | 5 ++++- apps/sim/tools/google_drive/get_content.ts | 5 ++++- apps/sim/tools/google_drive/list.ts | 5 ++++- apps/sim/tools/google_drive/upload.ts | 5 ++++- 12 files changed, 64 insertions(+), 15 deletions(-) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/credential-selector/components/oauth-required-modal.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/credential-selector/components/oauth-required-modal.tsx index 8d0744f22e..7de0951e55 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/credential-selector/components/oauth-required-modal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/components/sub-block/components/credential-selector/components/oauth-required-modal.tsx @@ -39,6 +39,7 @@ const SCOPE_DESCRIPTIONS: Record = { // 'https://www.googleapis.com/auth/gmail.readonly': 'View and read your email messages', // 'https://www.googleapis.com/auth/drive': 'View and manage your Google Drive files', 'https://www.googleapis.com/auth/drive.readonly': 'View and read your Google Drive files', + 'https://www.googleapis.com/auth/drive.file': 'View and manage your Google Drive files', // 'https://www.googleapis.com/auth/documents': 'View and manage your Google Docs', 'https://www.googleapis.com/auth/calendar': 'View and manage your calendar', 'https://www.googleapis.com/auth/userinfo.email': 'View your email address', diff --git a/apps/sim/blocks/blocks/google_docs.ts b/apps/sim/blocks/blocks/google_docs.ts index a74a0c2639..fb083c1e5d 100644 --- a/apps/sim/blocks/blocks/google_docs.ts +++ b/apps/sim/blocks/blocks/google_docs.ts @@ -37,7 +37,10 @@ export const GoogleDocsBlock: BlockConfig = { required: true, provider: 'google-docs', serviceId: 'google-docs', - requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'], + requiredScopes: [ + 'https://www.googleapis.com/auth/drive.readonly', + 'https://www.googleapis.com/auth/drive.file', + ], placeholder: 'Select Google account', }, // Document selector (basic mode) diff --git a/apps/sim/blocks/blocks/google_drive.ts b/apps/sim/blocks/blocks/google_drive.ts index c877044086..b618d97da4 100644 --- a/apps/sim/blocks/blocks/google_drive.ts +++ b/apps/sim/blocks/blocks/google_drive.ts @@ -36,7 +36,10 @@ export const GoogleDriveBlock: BlockConfig = { required: true, provider: 'google-drive', serviceId: 'google-drive', - requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'], + requiredScopes: [ + 'https://www.googleapis.com/auth/drive.readonly', + 'https://www.googleapis.com/auth/drive.file', + ], placeholder: 'Select Google Drive account', }, // Upload Fields @@ -80,7 +83,10 @@ export const GoogleDriveBlock: BlockConfig = { canonicalParamId: 'folderId', provider: 'google-drive', serviceId: 'google-drive', - requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'], + requiredScopes: [ + 'https://www.googleapis.com/auth/drive.readonly', + 'https://www.googleapis.com/auth/drive.file', + ], mimeType: 'application/vnd.google-apps.folder', placeholder: 'Select a parent folder', mode: 'basic', @@ -156,7 +162,10 @@ export const GoogleDriveBlock: BlockConfig = { canonicalParamId: 'folderId', provider: 'google-drive', serviceId: 'google-drive', - requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'], + requiredScopes: [ + 'https://www.googleapis.com/auth/drive.readonly', + 'https://www.googleapis.com/auth/drive.file', + ], mimeType: 'application/vnd.google-apps.folder', placeholder: 'Select a parent folder', mode: 'basic', @@ -183,7 +192,10 @@ export const GoogleDriveBlock: BlockConfig = { canonicalParamId: 'folderId', provider: 'google-drive', serviceId: 'google-drive', - requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'], + requiredScopes: [ + 'https://www.googleapis.com/auth/drive.readonly', + 'https://www.googleapis.com/auth/drive.file', + ], mimeType: 'application/vnd.google-apps.folder', placeholder: 'Select a folder to list files from', mode: 'basic', diff --git a/apps/sim/lib/auth.ts b/apps/sim/lib/auth.ts index f5a20cf261..a318bfc759 100644 --- a/apps/sim/lib/auth.ts +++ b/apps/sim/lib/auth.ts @@ -426,6 +426,7 @@ export const auth = betterAuth({ 'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/drive.readonly', + 'https://www.googleapis.com/auth/drive.file', ], prompt: 'consent', redirectURI: `${env.NEXT_PUBLIC_APP_URL}/api/auth/oauth2/callback/google-drive`, @@ -440,6 +441,7 @@ export const auth = betterAuth({ 'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/drive.readonly', + 'https://www.googleapis.com/auth/drive.file', ], prompt: 'consent', redirectURI: `${env.NEXT_PUBLIC_APP_URL}/api/auth/oauth2/callback/google-docs`, @@ -454,6 +456,7 @@ export const auth = betterAuth({ 'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/drive.readonly', + 'https://www.googleapis.com/auth/drive.file', ], prompt: 'consent', redirectURI: `${env.NEXT_PUBLIC_APP_URL}/api/auth/oauth2/callback/google-sheets`, diff --git a/apps/sim/lib/oauth/oauth.ts b/apps/sim/lib/oauth/oauth.ts index 6896c9ed29..cf88a82499 100644 --- a/apps/sim/lib/oauth/oauth.ts +++ b/apps/sim/lib/oauth/oauth.ts @@ -121,7 +121,10 @@ export const OAUTH_PROVIDERS: Record = { providerId: 'google-drive', icon: (props) => GoogleDriveIcon(props), baseProviderIcon: (props) => GoogleIcon(props), - scopes: ['https://www.googleapis.com/auth/drive.readonly'], + scopes: [ + 'https://www.googleapis.com/auth/drive.readonly', + 'https://www.googleapis.com/auth/drive.file', + ], }, 'google-docs': { id: 'google-docs', @@ -130,7 +133,10 @@ export const OAUTH_PROVIDERS: Record = { providerId: 'google-docs', icon: (props) => GoogleDocsIcon(props), baseProviderIcon: (props) => GoogleIcon(props), - scopes: ['https://www.googleapis.com/auth/drive.readonly'], + scopes: [ + 'https://www.googleapis.com/auth/drive.readonly', + 'https://www.googleapis.com/auth/drive.file', + ], }, 'google-sheets': { id: 'google-sheets', @@ -139,7 +145,10 @@ export const OAUTH_PROVIDERS: Record = { providerId: 'google-sheets', icon: (props) => GoogleSheetsIcon(props), baseProviderIcon: (props) => GoogleIcon(props), - scopes: ['https://www.googleapis.com/auth/drive.readonly'], + scopes: [ + 'https://www.googleapis.com/auth/drive.readonly', + 'https://www.googleapis.com/auth/drive.file', + ], }, 'google-forms': { id: 'google-forms', diff --git a/apps/sim/tools/google_docs/create.ts b/apps/sim/tools/google_docs/create.ts index 008652dcf4..3a21a715af 100644 --- a/apps/sim/tools/google_docs/create.ts +++ b/apps/sim/tools/google_docs/create.ts @@ -13,7 +13,10 @@ export const createTool: ToolConfig oauth: { required: true, provider: 'google-docs', - additionalScopes: ['https://www.googleapis.com/auth/drive.readonly'], + additionalScopes: [ + 'https://www.googleapis.com/auth/drive.readonly', + 'https://www.googleapis.com/auth/drive.file', + ], }, params: { diff --git a/apps/sim/tools/google_docs/write.ts b/apps/sim/tools/google_docs/write.ts index 4acf3b1cda..a82b6b4648 100644 --- a/apps/sim/tools/google_docs/write.ts +++ b/apps/sim/tools/google_docs/write.ts @@ -9,7 +9,10 @@ export const writeTool: ToolConfig