Skip to content

Commit 517f1a9

Browse files
aadamgoughAdam GoughAdam Gough
authored
fix(google-scopes): added forms and different drive scope (#1532)
* added google forms scope and google drive scope * added back file scope --------- Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net> Co-authored-by: Adam Gough <adamgough@Mac-530.lan>
1 parent dba7514 commit 517f1a9

File tree

12 files changed

+65
-15
lines changed

12 files changed

+65
-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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@ const SCOPE_DESCRIPTIONS: Record<string, string> = {
3838
'https://www.googleapis.com/auth/gmail.modify': 'View and manage your email messages',
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',
41+
'https://www.googleapis.com/auth/drive.readonly': 'View and read your Google Drive files',
4142
'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',
4546
'https://www.googleapis.com/auth/userinfo.profile': 'View your basic profile info',
47+
'https://www.googleapis.com/auth/forms.responses.readonly': 'View responses to your Google Forms',
4648
'read:page:confluence': 'Read Confluence pages',
4749
'write:page:confluence': 'Write Confluence pages',
4850
'read:me': 'Read your profile information',

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.file'],
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
@@ -37,7 +37,10 @@ export const GoogleDriveBlock: BlockConfig<GoogleDriveResponse> = {
3737
required: true,
3838
provider: 'google-drive',
3939
serviceId: 'google-drive',
40-
requiredScopes: ['https://www.googleapis.com/auth/drive.file'],
40+
requiredScopes: [
41+
'https://www.googleapis.com/auth/drive.readonly',
42+
'https://www.googleapis.com/auth/drive.file',
43+
],
4144
placeholder: 'Select Google Drive account',
4245
},
4346
// Create/Upload File Fields
@@ -110,7 +113,10 @@ export const GoogleDriveBlock: BlockConfig<GoogleDriveResponse> = {
110113
canonicalParamId: 'folderId',
111114
provider: 'google-drive',
112115
serviceId: 'google-drive',
113-
requiredScopes: ['https://www.googleapis.com/auth/drive.file'],
116+
requiredScopes: [
117+
'https://www.googleapis.com/auth/drive.readonly',
118+
'https://www.googleapis.com/auth/drive.file',
119+
],
114120
mimeType: 'application/vnd.google-apps.folder',
115121
placeholder: 'Select a parent folder',
116122
mode: 'basic',
@@ -186,7 +192,10 @@ export const GoogleDriveBlock: BlockConfig<GoogleDriveResponse> = {
186192
canonicalParamId: 'folderId',
187193
provider: 'google-drive',
188194
serviceId: 'google-drive',
189-
requiredScopes: ['https://www.googleapis.com/auth/drive.file'],
195+
requiredScopes: [
196+
'https://www.googleapis.com/auth/drive.readonly',
197+
'https://www.googleapis.com/auth/drive.file',
198+
],
190199
mimeType: 'application/vnd.google-apps.folder',
191200
placeholder: 'Select a parent folder',
192201
mode: 'basic',
@@ -213,7 +222,10 @@ export const GoogleDriveBlock: BlockConfig<GoogleDriveResponse> = {
213222
canonicalParamId: 'folderId',
214223
provider: 'google-drive',
215224
serviceId: 'google-drive',
216-
requiredScopes: ['https://www.googleapis.com/auth/drive.file'],
225+
requiredScopes: [
226+
'https://www.googleapis.com/auth/drive.readonly',
227+
'https://www.googleapis.com/auth/drive.file',
228+
],
217229
mimeType: 'application/vnd.google-apps.folder',
218230
placeholder: 'Select a folder to list files from',
219231
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
scopes: [
427427
'https://www.googleapis.com/auth/userinfo.email',
428428
'https://www.googleapis.com/auth/userinfo.profile',
429+
'https://www.googleapis.com/auth/drive.readonly',
429430
'https://www.googleapis.com/auth/drive.file',
430431
],
431432
prompt: 'consent',
@@ -440,6 +441,7 @@ export const auth = betterAuth({
440441
scopes: [
441442
'https://www.googleapis.com/auth/userinfo.email',
442443
'https://www.googleapis.com/auth/userinfo.profile',
444+
'https://www.googleapis.com/auth/drive.readonly',
443445
'https://www.googleapis.com/auth/drive.file',
444446
],
445447
prompt: 'consent',
@@ -454,6 +456,7 @@ export const auth = betterAuth({
454456
scopes: [
455457
'https://www.googleapis.com/auth/userinfo.email',
456458
'https://www.googleapis.com/auth/userinfo.profile',
459+
'https://www.googleapis.com/auth/drive.readonly',
457460
'https://www.googleapis.com/auth/drive.file',
458461
],
459462
prompt: 'consent',

apps/sim/lib/oauth/oauth.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,10 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
124124
providerId: 'google-drive',
125125
icon: (props) => GoogleDriveIcon(props),
126126
baseProviderIcon: (props) => GoogleIcon(props),
127-
scopes: ['https://www.googleapis.com/auth/drive.file'],
127+
scopes: [
128+
'https://www.googleapis.com/auth/drive.readonly',
129+
'https://www.googleapis.com/auth/drive.file',
130+
],
128131
},
129132
'google-docs': {
130133
id: 'google-docs',
@@ -133,7 +136,10 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
133136
providerId: 'google-docs',
134137
icon: (props) => GoogleDocsIcon(props),
135138
baseProviderIcon: (props) => GoogleIcon(props),
136-
scopes: ['https://www.googleapis.com/auth/drive.file'],
139+
scopes: [
140+
'https://www.googleapis.com/auth/drive.readonly',
141+
'https://www.googleapis.com/auth/drive.file',
142+
],
137143
},
138144
'google-sheets': {
139145
id: 'google-sheets',
@@ -142,7 +148,10 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
142148
providerId: 'google-sheets',
143149
icon: (props) => GoogleSheetsIcon(props),
144150
baseProviderIcon: (props) => GoogleIcon(props),
145-
scopes: ['https://www.googleapis.com/auth/drive.file'],
151+
scopes: [
152+
'https://www.googleapis.com/auth/drive.readonly',
153+
'https://www.googleapis.com/auth/drive.file',
154+
],
146155
},
147156
'google-forms': {
148157
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.file'],
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.file'],
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.file'],
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.file'],
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.file'],
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)