Search code examples
google-apps-scriptgoogle-classroomgoogle-apps-script-addon

Who is the "caller" when calling Form Submit installable trigger?


I have recently published a Google Forms add-on that access a Classroom Course roster right after the Form is submitted.

I manually installed the onSubmit trigger in my script and it worked fine. I copied the code to another Form and worked too, with GSuite and non-GSuite accounts.

The problem is that now that the add-on was published, I tested it and it doesn't work. Searching the GCP, in the Logs viewer I found a "The caller does not have permission at onSubmit(Code:40)" error from the API when calling the classroom method.

So, the trigger is working, but for some reason the permissions fail. I checked the scopes and they correctly request the appropriate permissions for the classroom method the onSubmit function calls. I'm wondering if the problem is that I manually installed the trigger and I should have it programmatically installed within the script.

Thoughts?


Solution

  • It turns out the answer depends on whether the trigger was manually installed or programmatically installed. If it's the former, then the "caller" is whoever installed the trigger (typically the developer) and if it's the later, then the "caller" is the user who installs the add-on (which was my intention).

    Thanks Alan!