Skip to content

Commit bf1719a

Browse files
authored
added new scope (#2110)
1 parent 619cab1 commit bf1719a

File tree

6 files changed

+48
-11
lines changed

6 files changed

+48
-11
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/credential-selector/components/oauth-required-modal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const SCOPE_DESCRIPTIONS: Record<string, string> = {
3737
'https://www.googleapis.com/auth/gmail.labels': 'View and manage your email labels',
3838
'https://www.googleapis.com/auth/gmail.modify': 'View and manage your email messages',
3939
'https://www.googleapis.com/auth/drive.file': 'View and manage your Google Drive files',
40+
'https://www.googleapis.com/auth/drive': 'Full access to all your Google Drive files',
4041
'https://www.googleapis.com/auth/calendar': 'View and manage your calendar',
4142
'https://www.googleapis.com/auth/userinfo.email': 'View your email address',
4243
'https://www.googleapis.com/auth/userinfo.profile': 'View your basic profile info',

apps/sim/blocks/blocks/google_docs.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ export const GoogleDocsBlock: BlockConfig<GoogleDocsResponse> = {
3535
required: true,
3636
provider: 'google-docs',
3737
serviceId: 'google-docs',
38-
requiredScopes: ['https://www.googleapis.com/auth/drive.file'],
38+
requiredScopes: [
39+
'https://www.googleapis.com/auth/drive.file',
40+
'https://www.googleapis.com/auth/drive',
41+
],
3942
placeholder: 'Select Google account',
4043
},
4144
// Document selector (basic mode)

apps/sim/blocks/blocks/google_drive.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ export const GoogleDriveBlock: BlockConfig<GoogleDriveResponse> = {
3636
required: true,
3737
provider: 'google-drive',
3838
serviceId: 'google-drive',
39-
requiredScopes: ['https://www.googleapis.com/auth/drive.file'],
39+
requiredScopes: [
40+
'https://www.googleapis.com/auth/drive.file',
41+
'https://www.googleapis.com/auth/drive',
42+
],
4043
placeholder: 'Select Google Drive account',
4144
},
4245
// Create/Upload File Fields
@@ -103,7 +106,10 @@ export const GoogleDriveBlock: BlockConfig<GoogleDriveResponse> = {
103106
canonicalParamId: 'folderId',
104107
provider: 'google-drive',
105108
serviceId: 'google-drive',
106-
requiredScopes: ['https://www.googleapis.com/auth/drive.file'],
109+
requiredScopes: [
110+
'https://www.googleapis.com/auth/drive.file',
111+
'https://www.googleapis.com/auth/drive',
112+
],
107113
mimeType: 'application/vnd.google-apps.folder',
108114
placeholder: 'Select a parent folder',
109115
mode: 'basic',
@@ -173,7 +179,10 @@ export const GoogleDriveBlock: BlockConfig<GoogleDriveResponse> = {
173179
canonicalParamId: 'folderId',
174180
provider: 'google-drive',
175181
serviceId: 'google-drive',
176-
requiredScopes: ['https://www.googleapis.com/auth/drive.file'],
182+
requiredScopes: [
183+
'https://www.googleapis.com/auth/drive.file',
184+
'https://www.googleapis.com/auth/drive',
185+
],
177186
mimeType: 'application/vnd.google-apps.folder',
178187
placeholder: 'Select a parent folder',
179188
mode: 'basic',
@@ -198,7 +207,10 @@ export const GoogleDriveBlock: BlockConfig<GoogleDriveResponse> = {
198207
canonicalParamId: 'folderId',
199208
provider: 'google-drive',
200209
serviceId: 'google-drive',
201-
requiredScopes: ['https://www.googleapis.com/auth/drive.file'],
210+
requiredScopes: [
211+
'https://www.googleapis.com/auth/drive.file',
212+
'https://www.googleapis.com/auth/drive',
213+
],
202214
mimeType: 'application/vnd.google-apps.folder',
203215
placeholder: 'Select a folder to list files from',
204216
mode: 'basic',
@@ -237,7 +249,10 @@ export const GoogleDriveBlock: BlockConfig<GoogleDriveResponse> = {
237249
canonicalParamId: 'fileId',
238250
provider: 'google-drive',
239251
serviceId: 'google-drive',
240-
requiredScopes: ['https://www.googleapis.com/auth/drive.file'],
252+
requiredScopes: [
253+
'https://www.googleapis.com/auth/drive.file',
254+
'https://www.googleapis.com/auth/drive',
255+
],
241256
placeholder: 'Select a file to download',
242257
mode: 'basic',
243258
dependsOn: ['credential'],

apps/sim/blocks/blocks/google_sheets.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ export const GoogleSheetsBlock: BlockConfig<GoogleSheetsResponse> = {
3636
required: true,
3737
provider: 'google-sheets',
3838
serviceId: 'google-sheets',
39-
requiredScopes: ['https://www.googleapis.com/auth/drive.file'],
39+
requiredScopes: [
40+
'https://www.googleapis.com/auth/drive.file',
41+
'https://www.googleapis.com/auth/drive',
42+
],
4043
placeholder: 'Select Google account',
4144
},
4245
// Spreadsheet Selector
@@ -47,7 +50,10 @@ export const GoogleSheetsBlock: BlockConfig<GoogleSheetsResponse> = {
4750
canonicalParamId: 'spreadsheetId',
4851
provider: 'google-sheets',
4952
serviceId: 'google-sheets',
50-
requiredScopes: ['https://www.googleapis.com/auth/drive.file'],
53+
requiredScopes: [
54+
'https://www.googleapis.com/auth/drive.file',
55+
'https://www.googleapis.com/auth/drive',
56+
],
5157
mimeType: 'application/vnd.google-apps.spreadsheet',
5258
placeholder: 'Select a spreadsheet',
5359
dependsOn: ['credential'],

apps/sim/lib/auth.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ export const auth = betterAuth({
430430
'https://www.googleapis.com/auth/userinfo.email',
431431
'https://www.googleapis.com/auth/userinfo.profile',
432432
'https://www.googleapis.com/auth/drive.file',
433+
'https://www.googleapis.com/auth/drive',
433434
],
434435
prompt: 'consent',
435436
redirectURI: `${getBaseUrl()}/api/auth/oauth2/callback/google-drive`,
@@ -444,6 +445,7 @@ export const auth = betterAuth({
444445
'https://www.googleapis.com/auth/userinfo.email',
445446
'https://www.googleapis.com/auth/userinfo.profile',
446447
'https://www.googleapis.com/auth/drive.file',
448+
'https://www.googleapis.com/auth/drive',
447449
],
448450
prompt: 'consent',
449451
redirectURI: `${getBaseUrl()}/api/auth/oauth2/callback/google-docs`,
@@ -458,6 +460,7 @@ export const auth = betterAuth({
458460
'https://www.googleapis.com/auth/userinfo.email',
459461
'https://www.googleapis.com/auth/userinfo.profile',
460462
'https://www.googleapis.com/auth/drive.file',
463+
'https://www.googleapis.com/auth/drive',
461464
],
462465
prompt: 'consent',
463466
redirectURI: `${getBaseUrl()}/api/auth/oauth2/callback/google-sheets`,

apps/sim/lib/oauth/oauth.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,10 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
140140
providerId: 'google-drive',
141141
icon: (props) => GoogleDriveIcon(props),
142142
baseProviderIcon: (props) => GoogleIcon(props),
143-
scopes: ['https://www.googleapis.com/auth/drive.file'],
143+
scopes: [
144+
'https://www.googleapis.com/auth/drive.file',
145+
'https://www.googleapis.com/auth/drive',
146+
],
144147
scopeHints: ['drive'],
145148
},
146149
'google-docs': {
@@ -150,7 +153,10 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
150153
providerId: 'google-docs',
151154
icon: (props) => GoogleDocsIcon(props),
152155
baseProviderIcon: (props) => GoogleIcon(props),
153-
scopes: ['https://www.googleapis.com/auth/drive.file'],
156+
scopes: [
157+
'https://www.googleapis.com/auth/drive.file',
158+
'https://www.googleapis.com/auth/drive',
159+
],
154160
scopeHints: ['docs'],
155161
},
156162
'google-sheets': {
@@ -160,7 +166,10 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
160166
providerId: 'google-sheets',
161167
icon: (props) => GoogleSheetsIcon(props),
162168
baseProviderIcon: (props) => GoogleIcon(props),
163-
scopes: ['https://www.googleapis.com/auth/drive.file'],
169+
scopes: [
170+
'https://www.googleapis.com/auth/drive.file',
171+
'https://www.googleapis.com/auth/drive',
172+
],
164173
scopeHints: ['sheets'],
165174
},
166175
'google-forms': {

0 commit comments

Comments
 (0)