Oauth doesn't work after adding the scope

624 views
Skip to first unread message

Endre Domokos

unread,
Aug 5, 2023, 6:48:34 AM8/5/23
to Google Apps Script Community
Hello! I'm working on a google sheet that could auto-generate me google forms with preset settings. For this I obviously need some AppsScript as well to work on the sheet.
I have a simple code where it just simply makes a new form with
var item = "test"
var form = FormApp.create(item)  
      .setTitle(item);
from an onEdit() function, however it says I don't have proper scope.

Error message:
Exception: You do not have permission to call FormApp.create. Required permissions: https://www.googleapis.com/auth/forms at createForm(Code:3:22) at onEdit(Code:34:7)

I added the scope in my appscript.json that is connected to my project:
{
  "timeZone": "Europe/Budapest",
  "dependencies": {
  },
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8"
}
Yet the issue still persists. Does anyone have any suggestions could be the problem?

cbmserv...@gmail.com

unread,
Aug 5, 2023, 5:11:12 PM8/5/23
to google-apps-sc...@googlegroups.com

With V8, OAuth scopes no longer show in the appscript.json file.

 

I would suggest just run the function manually the first time or create the trigger that you want. This will cause Google to pop up a script authorization window that will let you provide the authorization for the script to run. After that it should run with no issues.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/1fcb7bba-0243-464f-a4db-6581f96c9ba1n%40googlegroups.com.

Endre Domokos

unread,
Aug 6, 2023, 9:40:27 AM8/6/23
to Google Apps Script Community
I did your suggestion. It runs perfectly well when I manually triggered it in the editor. Sadly the onEdit() still didn't work afterwards.

I guess I'll just have to find some other trigger for it

CBMServices Web

unread,
Aug 6, 2023, 2:08:34 PM8/6/23
to google-apps-sc...@googlegroups.com
The onEdit is for simple triggers only and if it accesses any service outside of the spreadsheet itself it will not run.

You can setup a manual trigger to run it and authorize it.

Reply all
Reply to author
Forward
0 new messages