'Unable to execute GAS code on localhost even though I add oauthscope
I want to run GAS on localhost I setup clasp and could login correctly.
But when I execute clasp run, the following error occurs.
Exception: Exception: You do not have permission to call UrlFetchApp.fetch. Required permissions: https://www.googleapis.com/auth/script.external_request [
I added oauthScopes to my manifest, but it doesn't still work. Does anyone know why ??
This is my manifest.
{
"timeZone": "Asia/Tokyo",
"dependencies": {},
"oauthScopes": [
"https://www.googleapis.com/auth/script.external_request"
],
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8",
"executionApi": {
"access": "DOMAIN"
}
}
I use docker, but I don't think it is not problem
Solution 1:[1]
I know exactly the problem you're having. Some of the comments above mentioned what GAS is referring to and it's referring to Google Appscript which is what clasp is geared toward.
What worked for me was getting the oauthScopes in the place you define and I think you may need to get that specific scope in https://console.developers.google.com/apis/credentials/consent?project= where the project= is the project number that your api for this is associated with. From here you just edit the app in the oauth consent screen and go to the second step and paste https://www.googleapis.com/auth/script.external_request into the manual area whenever you add a scope.
After you have all of this and saved you will need to do clasp login --creds creds.json for it all to take effect it seems. Just make sure you have ALL of your scopes in appscript.json or you'll still have trouble. If you find another one having a problem, make sure you go back into the oauth consent and add whatever scopes are broken. And anytime you modify a scope, login with clasp login --creds creds.json again.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Saucey |
