Skip to content

Commit 544613f

Browse files
Adam GoughAdam Gough
authored andcommitted
added back file scope
1 parent e9e2c6f commit 544613f

File tree

12 files changed

+64
-15
lines changed

12 files changed

+64
-15
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/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
@@ -39,6 +39,7 @@ const SCOPE_DESCRIPTIONS: Record<string, string> = {
3939
// 'https://www.googleapis.com/auth/gmail.readonly': 'View and read your email messages',
4040
// 'https://www.googleapis.com/auth/drive': 'View and manage your Google Drive files',
4141
'https://www.googleapis.com/auth/drive.readonly': 'View and read your Google Drive files',
42+
'https://www.googleapis.com/auth/drive.file': 'View and manage your Google Drive files',
4243
// 'https://www.googleapis.com/auth/documents': 'View and manage your Google Docs',
4344
'https://www.googleapis.com/auth/calendar': 'View and manage your calendar',
4445
'https://www.googleapis.com/auth/userinfo.email': 'View your email address',

apps/sim/blocks/blocks/google_docs.ts

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

apps/sim/blocks/blocks/google_drive.ts

Lines changed: 16 additions & 4 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.readonly'],
39+
requiredScopes: [
40+
'https://www.googleapis.com/auth/drive.readonly',
41+
'https://www.googleapis.com/auth/drive.file',
42+
],
4043
placeholder: 'Select Google Drive account',
4144
},
4245
// Upload Fields
@@ -80,7 +83,10 @@ export const GoogleDriveBlock: BlockConfig<GoogleDriveResponse> = {
8083
canonicalParamId: 'folderId',
8184
provider: 'google-drive',
8285
serviceId: 'google-drive',
83-
requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'],
86+
requiredScopes: [
87+
'https://www.googleapis.com/auth/drive.readonly',
88+
'https://www.googleapis.com/auth/drive.file',
89+
],
8490
mimeType: 'application/vnd.google-apps.folder',
8591
placeholder: 'Select a parent folder',
8692
mode: 'basic',
@@ -156,7 +162,10 @@ export const GoogleDriveBlock: BlockConfig<GoogleDriveResponse> = {
156162
canonicalParamId: 'folderId',
157163
provider: 'google-drive',
158164
serviceId: 'google-drive',
159-
requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'],
165+
requiredScopes: [
166+
'https://www.googleapis.com/auth/drive.readonly',
167+
'https://www.googleapis.com/auth/drive.file',
168+
],
160169
mimeType: 'application/vnd.google-apps.folder',
161170
placeholder: 'Select a parent folder',
162171
mode: 'basic',
@@ -183,7 +192,10 @@ export const GoogleDriveBlock: BlockConfig<GoogleDriveResponse> = {
183192
canonicalParamId: 'folderId',
184193
provider: 'google-drive',
185194
serviceId: 'google-drive',
186-
requiredScopes: ['https://www.googleapis.com/auth/drive.readonly'],
195+
requiredScopes: [
196+
'https://www.googleapis.com/auth/drive.readonly',
197+
'https://www.googleapis.com/auth/drive.file',
198+
],
187199
mimeType: 'application/vnd.google-apps.folder',
188200
placeholder: 'Select a folder to list files from',
189201
mode: 'basic',

apps/sim/lib/auth.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ export const auth = betterAuth({
426426
'https://www.googleapis.com/auth/userinfo.email',
427427
'https://www.googleapis.com/auth/userinfo.profile',
428428
'https://www.googleapis.com/auth/drive.readonly',
429+
'https://www.googleapis.com/auth/drive.file',
429430
],
430431
prompt: 'consent',
431432
redirectURI: `${env.NEXT_PUBLIC_APP_URL}/api/auth/oauth2/callback/google-drive`,
@@ -440,6 +441,7 @@ export const auth = betterAuth({
440441
'https://www.googleapis.com/auth/userinfo.email',
441442
'https://www.googleapis.com/auth/userinfo.profile',
442443
'https://www.googleapis.com/auth/drive.readonly',
444+
'https://www.googleapis.com/auth/drive.file',
443445
],
444446
prompt: 'consent',
445447
redirectURI: `${env.NEXT_PUBLIC_APP_URL}/api/auth/oauth2/callback/google-docs`,
@@ -454,6 +456,7 @@ export const auth = betterAuth({
454456
'https://www.googleapis.com/auth/userinfo.email',
455457
'https://www.googleapis.com/auth/userinfo.profile',
456458
'https://www.googleapis.com/auth/drive.readonly',
459+
'https://www.googleapis.com/auth/drive.file',
457460
],
458461
prompt: 'consent',
459462
redirectURI: `${env.NEXT_PUBLIC_APP_URL}/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
@@ -121,7 +121,10 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
121121
providerId: 'google-drive',
122122
icon: (props) => GoogleDriveIcon(props),
123123
baseProviderIcon: (props) => GoogleIcon(props),
124-
scopes: ['https://www.googleapis.com/auth/drive.readonly'],
124+
scopes: [
125+
'https://www.googleapis.com/auth/drive.readonly',
126+
'https://www.googleapis.com/auth/drive.file',
127+
],
125128
},
126129
'google-docs': {
127130
id: 'google-docs',
@@ -130,7 +133,10 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
130133
providerId: 'google-docs',
131134
icon: (props) => GoogleDocsIcon(props),
132135
baseProviderIcon: (props) => GoogleIcon(props),
133-
scopes: ['https://www.googleapis.com/auth/drive.readonly'],
136+
scopes: [
137+
'https://www.googleapis.com/auth/drive.readonly',
138+
'https://www.googleapis.com/auth/drive.file',
139+
],
134140
},
135141
'google-sheets': {
136142
id: 'google-sheets',
@@ -139,7 +145,10 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
139145
providerId: 'google-sheets',
140146
icon: (props) => GoogleSheetsIcon(props),
141147
baseProviderIcon: (props) => GoogleIcon(props),
142-
scopes: ['https://www.googleapis.com/auth/drive.readonly'],
148+
scopes: [
149+
'https://www.googleapis.com/auth/drive.readonly',
150+
'https://www.googleapis.com/auth/drive.file',
151+
],
143152
},
144153
'google-forms': {
145154
id: 'google-forms',

apps/sim/tools/google_docs/create.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ export const createTool: ToolConfig<GoogleDocsToolParams, GoogleDocsCreateRespon
1313
oauth: {
1414
required: true,
1515
provider: 'google-docs',
16-
additionalScopes: ['https://www.googleapis.com/auth/drive.readonly'],
16+
additionalScopes: [
17+
'https://www.googleapis.com/auth/drive.readonly',
18+
'https://www.googleapis.com/auth/drive.file',
19+
],
1720
},
1821

1922
params: {

apps/sim/tools/google_docs/read.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ export const readTool: ToolConfig<GoogleDocsToolParams, GoogleDocsReadResponse>
1111
oauth: {
1212
required: true,
1313
provider: 'google-docs',
14-
additionalScopes: ['https://www.googleapis.com/auth/drive.readonly'],
14+
additionalScopes: [
15+
'https://www.googleapis.com/auth/drive.readonly',
16+
'https://www.googleapis.com/auth/drive.file',
17+
],
1518
},
1619

1720
params: {

apps/sim/tools/google_docs/write.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ export const writeTool: ToolConfig<GoogleDocsToolParams, GoogleDocsWriteResponse
99
oauth: {
1010
required: true,
1111
provider: 'google-docs',
12-
additionalScopes: ['https://www.googleapis.com/auth/drive.readonly'],
12+
additionalScopes: [
13+
'https://www.googleapis.com/auth/drive.readonly',
14+
'https://www.googleapis.com/auth/drive.file',
15+
],
1316
},
1417
params: {
1518
accessToken: {

apps/sim/tools/google_drive/create_folder.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ export const createFolderTool: ToolConfig<GoogleDriveToolParams, GoogleDriveUplo
1010
oauth: {
1111
required: true,
1212
provider: 'google-drive',
13-
additionalScopes: ['https://www.googleapis.com/auth/drive.readonly'],
13+
additionalScopes: [
14+
'https://www.googleapis.com/auth/drive.readonly',
15+
'https://www.googleapis.com/auth/drive.file',
16+
],
1417
},
1518

1619
params: {

apps/sim/tools/google_drive/get_content.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ export const getContentTool: ToolConfig<GoogleDriveToolParams, GoogleDriveGetCon
1818
oauth: {
1919
required: true,
2020
provider: 'google-drive',
21-
additionalScopes: ['https://www.googleapis.com/auth/drive.readonly'],
21+
additionalScopes: [
22+
'https://www.googleapis.com/auth/drive.readonly',
23+
'https://www.googleapis.com/auth/drive.file',
24+
],
2225
},
2326

2427
params: {

0 commit comments

Comments
 (0)