I created 2 simple standalone scripts to test the authorization workflow. The first script is a web app that is accessible only to me.
function doGet(e) {
r
If you are still looking for this answer, how about this answer? I think that when the scopes are installed by Manifests, you can access the Web Apps using the access token with the scopes.
The condition for deploying Web Apps is as follows.
doGet()
.
At above condition, when "headers": {"Authorization":"Bearer " + token}
is not used for option
, the error occurs. So in order to access to Web Apps with above condition, please add the following 2 scopes. In your case, the following scopes are required to authorize.
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/script.external_request
In your case, the above 2 scopes are required. In the case of only https://www.googleapis.com/auth/script.external_request
, the error of Unauthorized
occurs.
Please install above scopes to Manifests (appsscript.json
) as follows.
call()
.
oauthScopes
to appsscript.json
.
"oauthScopes": ["https://www.googleapis.com/auth/script.external_request", "https://www.googleapis.com/auth/drive"]
After it installed above, please try to run your call()
again. In my environment, I retrieved the following response.
200.0
{"message":"works!"}
If I misunderstand your question, I'm sorry.