Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thanks! and another method #1

Open
fastfourier666 opened this issue Aug 15, 2022 · 0 comments
Open

Thanks! and another method #1

fastfourier666 opened this issue Aug 15, 2022 · 0 comments

Comments

@fastfourier666
Copy link

Hi tanaike,

Thank you for this document, there's a lot of useful info in here.

I am making a web app outside Google (PHP & Javascript) which talks to a Google sheet. I was trying to follow the method for "using dev mode from outside" and it didn't work for me. the curl results were returning 401 errors. To be honest the whole OAuth thing is a bit confusing for me and I am quite new to the Google stuff - I may have been doing something very wrong!

I did find another method though, which might be useful in the future. I used two projects. The first is a "shim" that passes through doGet and doPost to a library:

function doPost(r) {
  return ContentService.createTextOutput(my_lib.doPost(r));
}

function doGet(r) {
  return ContentService.createTextOutput(my_lib.doGet(r));
}

The second project (my_lib) contains the main program and also implements doGet and doPost, but you add it to the shim as a library in HEAD (Development mode). All the changes to my_lib are immediately accessible to curl in php via the /exec endpoint of the shim project.

Once development is complete you can get rid of the shim and deploy the library project normally as a web app.

Any permissions you need, you have to create a function in the shim project to force the authentication dialog to pop up (e.g. sending an email).

Debugging is a bit tricky. None of the Logger.log () calls appear in the execution log of my_lib. I ended up pushing debug info back to the calling web page as JSON and displaying it there.

Anyway, just thought I'd make a note of this here. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant