a google verified app script, got 403 error: "The caller does not have permission"

Viewed 69

I have a google verified, published app script deployed as a web app. It generates a form as a classwork in google classroom. When accessing the app from my own google classroom account, it runs ok. However, when accessing the app from other google classroom accounts, I got error:

"code": 403, "message": "The caller does not have permission", "status": "PERMISSION_DENIED".

Below is the appscript.json of the script:

{
  "timeZone": "America/New_York",
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8",
  "dependencies": {
    "enabledAdvancedServices": [
      {
        "userSymbol": "Classroom",
        "version": "v1",
        "serviceId": "classroom"
      }
    ]
  },
  "webapp": {
    "executeAs": "USER_ACCESSING",
    "access": "ANYONE"
  },
  "executionApi": {
    "access": "ANYONE"
  },
  "oauthScopes": [
    "https://www.googleapis.com/auth/script.external_request",
    "https://www.googleapis.com/auth/forms",
    "https://www.googleapis.com/auth/classroom.rosters.readonly"
  ]
}

The Oauth consent screen shows:

Verification Status
Verified

Your consent screen has been verified. If you make changes that require verification later, you must resubmit your application for review. Learn more

Publishing status

In production

User type

External

Do you have similar experience? What could be the problem, and how to get around this?

2 Answers

I found the problem: When switching from test mode to live mode, I missed removing the devMod setting.In addition, the scriptId must be changed to the deployed id (version controled) so that the script can be found.

It's very likely that the other "google classroom" users are getting the error because the aren't domain administrators.

From https://developers.google.com/classroom/guides/get-started

Who can use the API? G Suite for Education domain administrators can use the API to programmatically provision courses on behalf of teachers, sync student information systems with Classroom, and get basic visibility into classes being taught in their domain.

Related