Skip to content

Commit b6a5588

Browse files
committed
Modified
1 parent e3b1b1f commit b6a5588

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,16 @@ For detailed instructions, please refer to [https://gist.github.com/tanaikech/eb
161161
- "Who has access to the app:": **Only myself**
162162
1. **Situation 2**
163163
- "Execute the app as:" : **Me**
164-
- "Who has access to the app:": **Anyone**
164+
- "Who has access to the app:": **Anyone with Google account**
165165
1. **Situation 3**
166166
- "Execute the app as:" : **Me**
167-
- "Who has access to the app:": **Anyone, even anonymous**
167+
- "Who has access to the app:": **Anyone**
168168
1. **Situation 4**
169169
- "Execute the app as:" : **User accessing the web app**
170170
- "Who has access to the app:": **Only myself**
171171
1. **Situation 5**
172172
- "Execute the app as:" : **User accessing the web app**
173-
- "Who has access to the app:": **Anyone**
173+
- "Who has access to the app:": **Anyone with Google account**
174174

175175
# Understanding Access and Interaction
176176

@@ -321,17 +321,17 @@ For example, in **Situation 5**, the Web App's script runs as each user (both th
321321

322322
## Access Token for Accessing Web Apps
323323

324-
* When a Web App is deployed with **"`Who has access to the app:` Only myself`"** or **"`Who has access to the app:` Anyone`"** by the owner, both the owner and client users must access and run the Web App's script using their own access token.
324+
* When a Web App is deployed with **"`Who has access to the app:` Only myself`"** or **"`Who has access to the app: Anyone with Google account`"** by the owner, both the owner and client users must access and run the Web App's script using their own access token.
325325
* At least one Drive API scope must be included in the access token. Examples include:
326326
* `https://www.googleapis.com/auth/drive.readonly`
327327
* `https://www.googleapis.com/auth/drive.files`
328328
* `https://www.googleapis.com/auth/drive`
329329
* Even if the server script uses scopes other than those for Drive API, these additional scopes are not required to be included in the access token. This is because the use of other scopes is authorized through the browser before accessing the Web App. This means that when making GET or POST requests to the Web App, only Drive API scopes are required.
330330
* For instance, when accessing a Web App using Google Apps Script, if you use `{"Authorization": "Bearer " + ScriptApp.getOAuthToken()}` in the headers and encounter an `<TITLE>Unauthorized</TITLE>` error, check the scopes defined in your script editor. If `https://www.googleapis.com/auth/drive` is not included, you can add it by, for example, placing `// DriveApp.getFiles()` in your script **as a comment**. The script editor will then automatically include the `https://www.googleapis.com/auth/drive` scope.
331331
332-
* If no scopes are used in the Web App's scripts, the owner and client users can run the script without browser-based scope authorization. However, an access token is still required to access the Web App if it's deployed as **"`Who has access to the app:` Only myself`"** or **"`Who has access to the app:` Anyone`"**.
332+
* If no scopes are used in the Web App's scripts, the owner and client users can run the script without browser-based scope authorization. However, an access token is still required to access the Web App if it's deployed as **"`Who has access to the app:` Only myself`"** or **"`Who has access to the app: Anyone with Google account`"**.
333333
334-
* Only when the Web App is deployed as **"`Who has access to the app:` Anyone, even anonymous`"** can the owner and client users access the Web App without an access token.
334+
* Only when the Web App is deployed as **"`Who has access to the app: Anyone`"** can the owner and client users access the Web App without an access token.
335335
336336
---
337337
@@ -1014,7 +1014,7 @@ const doPost = (e) => {
10141014
};
10151015
```
10161016

1017-
- This Web App is deployed with `Execute the app as: Me` and `Who has access to the app: Anyone, even anonymous`.
1017+
- This Web App is deployed with `Execute the app as: Me` and `Who has access to the app: Anyone`.
10181018

10191019
#### 2. Sample Google Apps Script Project Types
10201020

@@ -1065,9 +1065,9 @@ The following table summarizes where logs can be found under different condition
10651065

10661066
From the above results, the following conclusions were drawn:
10671067

1068-
- If you are using a default Google Apps Script project without linking a GCP project, to retrieve logs from requests to your Web App, you must access the Web App using an access token. This applies even when the Web App is deployed as `Execute the app as: Me` and `Who has access to the app: Anyone, even anonymous`.
1068+
- If you are using a default Google Apps Script project without linking a GCP project, to retrieve logs from requests to your Web App, you must access the Web App using an access token. This applies even when the Web App is deployed as `Execute the app as: Me` and `Who has access to the app: Anyone`.
10691069

1070-
- If you are using a Google Apps Script project with a linked GCP project, all user access logs to the Web App can be retrieved in Stackdriver. This is true even when the Web App is deployed as `Execute the app as: Me` and `Who has access to the app: Anyone, even anonymous`.
1070+
- If you are using a Google Apps Script project with a linked GCP project, all user access logs to the Web App can be retrieved in Stackdriver. This is true even when the Web App is deployed as `Execute the app as: Me` and `Who has access to the app: Anyone`.
10711071

10721072
- In all experimental scenarios, logs generated by `Logger.log` were not visible.
10731073

@@ -1085,11 +1085,11 @@ When the error messages are returned from Web Apps, you can see the messages int
10851085
10861086
| Execute the app as | Who has access to the app | Access | Status code | Error messages | Reason |
10871087
| :-------------------------------- | :------------------------ | :-------------- | :---------- | :----------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------- |
1088-
| User accessing the web app | Only myself,<br>Anyone | Owner,<br>Users | 200 | Authorization needed | Scopes for scripts of Web Apps are not authorized. |
1089-
| User accessing the web app,<br>Me | Only myself,<br>Anyone | Owner,<br>Users | 200 | Meet Google Drive 窶・One place for all your files | No access token. |
1088+
| User accessing the web app | Only myself,<br>Anyone with Google account | Owner,<br>Users | 200 | Authorization needed | Scopes for scripts of Web Apps are not authorized. |
1089+
| User accessing the web app,<br>Me | Only myself,<br>Anyone with Google account | Owner,<br>Users | 200 | Meet Google Drive 窶・One place for all your files | No access token. |
10901090
| For all settings | For all settings | Owner,<br>Users | 200 | Error | "Service invoked too many times in a short time: exec qps. Try Utilities.sleep(1000) between calls." is shown in Body. |
1091-
| User accessing the web app,<br>Me | Only myself,<br>Anyone | Owner,<br>Users | 401 | Unauthorized | Bad access token.<br>No required scopes. |
1092-
| User accessing the web app,<br>Me | Anyone | Users | 403 | Google Drive - Access Denied | Project of Web Apps is not shared with users. |
1091+
| User accessing the web app,<br>Me | Only myself,<br>Anyone with Google account | Owner,<br>Users | 401 | Unauthorized | Bad access token.<br>No required scopes. |
1092+
| User accessing the web app,<br>Me | Anyone with Google account | Users | 403 | Google Drive - Access Denied | Project of Web Apps is not shared with users. |
10931093
| User accessing the web app,<br>Me | Only myself | Users | 404 | Google Drive -- Page Not Found | Users cannot access. |
10941094
10951095
---
@@ -1102,7 +1102,7 @@ Here, I'll explain the status codes returned from Google Apps Script Web Apps.
11021102

11031103
### Preparation
11041104

1105-
For this experiment, a Web App was deployed with "Execute the app as" set to `Me` and "Who has access to the app" set to `Anyone, even anonymous`. The sample script for the Web App is as follows:
1105+
For this experiment, a Web App was deployed with "Execute the app as" set to `Me` and "Who has access to the app" set to `Anyone`. The sample script for the Web App is as follows:
11061106

11071107
```javascript
11081108
function doGet(e) {
@@ -1176,7 +1176,7 @@ A status code of `403` was returned. From these results, the following conclusio
11761176
11771177
One application where this situation is relevant is when registering a webhook with [Trello's REST API](https://developers.trello.com/reference/).
11781178
1179-
When a Web App deployed with "Execute the app as: Me" and "Who has access to the app: Anyone, even anonymous" is registered as a webhook, an error like `{"message":"URL (https://script.google.com/macros/s/###/exec) did not return 200 status code, got 403","error":"ERROR"}` occurs. This error is due to the situation described above.
1179+
When a Web App deployed with "`Execute the app as: Me`" and "`Who has access to the app: Anyone`" is registered as a webhook, an error like `{"message":"URL (https://script.google.com/macros/s/###/exec) did not return 200 status code, got 403","error":"ERROR"}` occurs. This error is due to the situation described above.
11801180
11811181
As a workaround for registration, you can use the following flow:
11821182
@@ -1185,7 +1185,7 @@ As a workaround for registration, you can use the following flow:
11851185
* "Who has access to the app": `Only myself`
11861186
* **After retrieving the response** (e.g., `{"id":"###","description":"sample","idModel":"###","callbackURL":"https://script.google.com/macros/s/###/exec","active":true}`), reset the Web App's permissions as follows:
11871187
* "Execute the app as": `Me`
1188-
* "Who has access to the app": `Anyone, even anonymous`
1188+
* "Who has access to the app": `Anyone`
11891189
11901190
By following this flow, the webhook can be successfully used.
11911191
@@ -1211,7 +1211,7 @@ Logger.log(res.getContentText());
12111211
12121212
## CORS in Web Apps
12131213
1214-
This section explores **Cross-Origin Resource Sharing (CORS)** in Google Apps Script Web Apps. We'll examine various scenarios where Web Apps are accessed via `GET` and `POST` methods using JavaScript. For these examples, the Web App settings are configured as `Execute the app as: Me` and `Who has access to the app: Anyone, even anonymous`.
1214+
This section explores **Cross-Origin Resource Sharing (CORS)** in Google Apps Script Web Apps. We'll examine various scenarios where Web Apps are accessed via `GET` and `POST` methods using JavaScript. For these examples, the Web App settings are configured as `Execute the app as: Me` and `Who has access to the app: Anyone`.
12151215
12161216
The following client-side JavaScript was used for testing:
12171217
@@ -2287,7 +2287,7 @@ These are the sample scripts by the various languages for requesting to [Web App
22872287
- Setting for Web Apps is as follows.
22882288
22892289
- **`Execute the app as: Me`**
2290-
- **`Who has access to the app: Anyone, even anonymous`**
2290+
- **`Who has access to the app: Anyone`**
22912291
- In this settings, no access token is required. When you use other settings, it might be required to use the access token. About this, please check [here](https://github.com/tanaikech/taking-advantage-of-Web-Apps-with-google-apps-script#5-situations-for-web-apps).
22922292
22932293
<a name="curl"></a>

0 commit comments

Comments
 (0)