Skip to content

Commit fbc7865

Browse files
committed
fix: Add currentonly scopes for Apps Script for Docs, Sheets, Slides, and Forms.
1 parent f6b3479 commit fbc7865

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

.changeset/angry-apes-sing.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"google-workspace-developer-tools": patch
3+
---
4+
5+
Added missing currentonly scopes for Apps Script (Docs, Sheets, Slides, Forms). The currentonly scope is only available within Apps Script Services. This does not include Apps Script Advanced Services or direct calls to Google Workspace APIs.
6+
7+
For more information, see [Editor scopes](https://developers.google.com/workspace/add-ons/concepts/workspace-scopes#editor-scopes) and [Apps Script currentonly scopes](https://justin.poehnelt.com/posts/apps-script-currentonly-scopes/).

packages/vscode-extension/src/scopes.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,33 @@ for (const { title, version, documentationLink, scopes } of GOOGLE_APIS || []) {
6666

6767
export const SCRIPT_EXTERNAL_REQUEST_SCOPE =
6868
"https://www.googleapis.com/auth/script.external_request";
69-
7069
SCOPES.set(SCRIPT_EXTERNAL_REQUEST_SCOPE, {
7170
description: "Connect to an external service",
7271
apis: [],
7372
});
7473

74+
/**
75+
* Scopes that are only available for the current document.
76+
*
77+
* @see https://developers.google.com/workspace/add-ons/concepts/workspace-scopes#editor-scopes
78+
* @see https://justin.poehnelt.com/posts/apps-script-currentonly-scopes/
79+
*/
80+
export const CURRENT_ONLY_SCOPES = [
81+
"https://www.googleapis.com/auth/documents.currentonly",
82+
"https://www.googleapis.com/auth/forms.currentonly",
83+
"https://www.googleapis.com/auth/presentations.currentonly",
84+
"https://www.googleapis.com/auth/spreadsheets.currentonly",
85+
];
86+
87+
for (const scope of CURRENT_ONLY_SCOPES) {
88+
SCOPES.set(scope, {
89+
description:
90+
"Access the current document, sheet, presentation, or form. The `currentonly` scope is only available within Apps Script Services. This does not include Apps Script Advanced Services or direct calls to Google Workspace APIs.",
91+
classification: ScopeClassification.NON_SENSITIVE,
92+
apis: [],
93+
});
94+
}
95+
7596
const RESTRICTED_SCOPES = [
7697
"https://www.googleapis.com/auth/chat.admin.delete",
7798
"https://www.googleapis.com/auth/chat.app.delete",

0 commit comments

Comments
 (0)