At April 8, 2019, the specification of Google Apps Script Project was changed. You can see this at Google Cloud Platform Projects. The official document says as follows.
Warning: Starting on or after April 8, 2019, the Google Cloud Platform Console won't be able to access the default GCP projects created for new Apps Script projects. Older, existing scripts may have default GCP projects that are still accessible, however. If you have a new script and require access to its GCP project from the Google Cloud Platform Console, you must use a standard GCP project.
And then,
When a new Apps Script project is created, a default GCP project is also created behind the scenes. This GCP project is hidden, meaning most users aren't able to directly locate, view, or update the project in the Google Cloud Platform Console. However, admins and domain users that have the resourcemanager.projects.list permission on the parenting GCP folder are able to view and configure default projects.
By this, when users create new Google Apps Script Project (the container-bound script and the standalone script) after April 8, 2019, it is required to link Cloud Platform Project to the created Google Apps Script Project (GAS project). In this document, I would like to introduce the flow for linking Cloud Platform Project to GAS project.
In this section, by creating new Cloud Platform Project and new GAS project, the flow for linking Cloud Platform Project to GAS project is explained.
- In this case, you can create the projects of the container-bound script type and the standalone script type. When the GAS project is created after April 8, 2019, when you see "Resource" -> "Cloud Platform Project" at the script editor, the following screen can be seen.
- By this This script has an Apps Script–managed Cloud Platform project., when users want to use Google APIs except for Advanced Google Services, it is required to link Cloud Platform Project to this GAS project.
- Access to Manage resources of Google Cloud Platform. And click "CREATE PROJECT" like below.
- Input the project name and click "CREATE" button.
- You can see the created Cloud Platform Project by reloading "Manage resources of Google Cloud Platform".
- For the cerated Cloud Platform Project, open the setting page by clicking "Settings" like below.
When new Cloud Platform Project is created, there are no credentials. So when users want to use Google API from outside, it is required to create new credentials. In the most cases, this situation is required. So here, I would like to introduce to create new credentials. On the other hand, the GAS project linked to Cloud Platform Project automatically creates the credential.
- From the navigation menu like below, and jump to "Credentials"
- Before create the credential, open "OAuth concent screen" like below. And input "Application name" and click "Save" button.
- Create new credential. Create OAuth client ID like below.
- Select "Web application" and input "Name". Then, click "Create" button.
- By this, new credential could be created.
- Open the script editor which is the created new GAS project.
- Open a dialog by "Resource" -> "Cloud Platform Project" at the script editor. You can see below dialog.
- Put the retrieved project number to "Enter Project Number here".
- Click "Set Project". And click "Confirm" button.
- When "Success! Project Changed" is shown, it means that Cloud Platform Project was linked to GAS project.
- At this time, if "Close" button cannot be used, you can close the dialog by clicking "X" button at the top right.
- In my environment, as a test case, I could confirm that the method of scripts.run in Google Apps Script API worked fine using the created credentials and the GAS project linked with Cloud Platform Project.
after all this steps i still get on GPhotoApp.getAlbumList(); === Error: { "error": { "code": 400, "message": "Invalid JSON payload received. Unknown name "nextPageToken": Cannot bind query parameter. Field 'nextPageToken' could not be found in request message.", "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [ { "description": "Invalid JSON payload received. Unknown name "nextPageToken": Cannot bind query parameter. Field 'nextPageToken' could not be found in request message." } ] } ] } }