google / clasp

🔗 Command Line Apps Script Projects
https://developers.google.com/apps-script/guides/clasp
Apache License 2.0
4.52k stars 422 forks source link

clasp run gives permission denied, non-google-workspace setup #881

Open r4nt opened 2 years ago

r4nt commented 2 years ago

(Note: Non-breaking issues are likely not to be prioritized. Please consider a PR in addition to your issue)

Expected Behavior

I'd like to use clasp for my personal spreadsheet automation. I followed all the steps correctly (I hope :), but one step I couldn't follow exactly was the OAuth creation step: I only can create an external project, as my user is not part of a google workspace. I set up an external OAuth and added my user as a test user. I'd expect clasp run function to run the function

Actual Behavior

clasp run function

Error: Permission denied. Be sure that you have:

Steps to Reproduce the Problem

  1. Create new standalone project
  2. Follow steps for clasp run setup

    appscript.json { "timeZone": "America/New_York", "dependencies": { }, "exceptionLogging": "STACKDRIVER", "runtimeVersion": "V8", "oauthScopes": [ "https://www.googleapis.com/auth/spreadsheets", "https://www.googleapis.com/auth/spreadsheets.readonly", "https://www.googleapis.com/auth/spreadsheets.currentonly" ], "executionApi": { "access": "ANYONE" } }

Other files containing secrets (.clasp.json, .clasprc.json, creds.json) look ok.

Specifications

JohnFrrr commented 1 year ago

All you have to do is to access "https://console.cloud.google.com/apis/library/script.googleapis.com?project={Your_GCP_project_ID}" and activate (again, because it's no use activating only in script.google.com) the Google App Script API. After that your code will run, if your function doesn't have a return it will return "No response", but it is a sign that it was executed successfully.