0
votes

I found plenty of questions regarding this issues, but no one answer that could solve my problem.

I have a project in Apps Script, which I deployed as API executable. I enabled Google App Script Execution API. I made OAuth 2.0 Client ID on developer console. I made everything step-by-step as described here: https://developers.google.com/apps-script/guides/rest/api

Then I try to execute code from Google API Explorer: https://developers.google.com/apis-explorer/#p/script/v1/

I fill in request body properly, fill in script id (take it from "File > Project properties" from App Script editor), but what I get is "Permission denied":

enter image description here

Well, I tried to do the same from PyCharm (Python). I fully followed the following instruction: https://developers.google.com/apps-script/guides/rest/quickstart/python

Guess, what I got... The same error!

The Apps Script project is saved in my corporate Google Drive. The scopes of the project are: https://www.google.com/calendar/feeds https://www.googleapis.com/auth/script.external_request , which I filled in correctly in Python and shouldn't fill in in API Explorer.

Many users recommend to check if the project is correctly associated with a project on Google Cloud Platform. When I try to change project, I get error: "The project number should not match." Probably because it is associated correctly...

I almost lost my hope... Again, I saw a lot of answers to this issue across StackExchange forums, but no one could have solved this problem.

One more note: I didn't sign up for the Google Cloud Platform (I don't have a work account there, although it sees my projects and I could have generated OAuth2 2.0 Client ID and API key.

1

1 Answers

1
votes

Well, I deleted my python project along with the .credentials file and recreated the project - then it worked. So probably it didn't work, because I missed one of described steps at the first execution of the code and after I fulfilled all the requirements I went on using old creds.

So for all who faces the same problem:

  1. Do everything what is described in the Google documentation and my question.
  2. If you missed something, delete the .credentials file and run the code again. Then it should work.