diff --git a/README.ja.md b/README.ja.md index 69c625d..5d73cc0 100644 --- a/README.ja.md +++ b/README.ja.md @@ -196,7 +196,9 @@ pnpm run deploy ### OAuth スコープの追加 -`appsscript.json` の `oauthScopes` を編集: +デフォルトでは `appsscript.json` に `oauthScopes` フィールドは含まれていません。これにより、Apps Script が実行時に必要最小限のスコープを自動推論するため、個人 Google アカウントでの OAuth 同意画面ブロックを回避できます(一般ユーザーアカウントは Google の [OAuth アプリ確認要件](https://support.google.com/cloud/answer/9110914) の対象であり、明示的なスコープは「確認されていないアプリ」警告を発生させることがあります)。 + +プロジェクトで特定のスコープが必要な場合(例: `UrlFetchApp`、スプレッドシート、Drive)、`appsscript.json` に `oauthScopes` フィールドを追加してください: ```json { @@ -207,6 +209,8 @@ pnpm run deploy } ``` +> **注意**: `oauthScopes` を宣言すると、Apps Script はスコープの自動推論を停止します。プロジェクトが必要とするすべてのスコープを明示的にリストする必要があります。 + ### ソースファイルの追加 1. `src/` にモジュールを作成(例: `src/utils.ts`) diff --git a/README.md b/README.md index c0037d0..87c5292 100644 --- a/README.md +++ b/README.md @@ -196,7 +196,9 @@ Configured via [`h13/renovate-config:node`](https://github.com/h13/renovate-conf ### Adding OAuth Scopes -Edit `oauthScopes` in `appsscript.json`: +By default, `appsscript.json` does not include an `oauthScopes` field. This lets Apps Script automatically infer the minimal scopes needed at runtime, which avoids OAuth consent screen blocks on personal Google accounts (consumer accounts are subject to Google's [OAuth app verification requirements](https://support.google.com/cloud/answer/9110914), and explicit scopes can trigger an "unverified app" warning). + +If your project requires specific scopes (e.g., for `UrlFetchApp`, Spreadsheets, or Drive), add the `oauthScopes` field to `appsscript.json`: ```json { @@ -207,6 +209,8 @@ Edit `oauthScopes` in `appsscript.json`: } ``` +> **Note**: Once you declare `oauthScopes`, Apps Script stops inferring scopes automatically. You must list every scope your project needs. + ### Adding Source Files 1. Create a module in `src/` (e.g., `src/utils.ts`) diff --git a/appsscript.json b/appsscript.json index 3a16e33..03c86f2 100644 --- a/appsscript.json +++ b/appsscript.json @@ -6,6 +6,5 @@ "webapp": { "access": "ANYONE", "executeAs": "USER_ACCESSING" - }, - "oauthScopes": ["https://www.googleapis.com/auth/script.external_request"] + } }