2
votes

I'm trying to develop a simple web app using google script web app service and access it from another script using the UrlFetch service.

My problem is that in order to try the code on my web app I have to publish a new version every time because trying to access to the dev URL returns returns and HTML file telling me to sign in even though I've set the permissions for the web app to everyone, including anonymous (if I hit the production URL it does work, though).

I'm assuming that Google is limiting the access to the dev URL for security reasons but can someone shed a light on that assumption?

PS: I don't know if this is relevant but my google account is in a Google Apps for Education domain

Edit

I've found a method to avoid publishing the application for each code change: instead of calling it from the UrlFetch service, I've created a function in the web App code that does call the doPost or the doGet method (I've to create the request param, but that's easy) and I've changed the end of the script to log the result insted of returing it to the client. When the application will be ready, I can publish and develop the client using the UrlFetch.

Anyhow, if anyone knows about the limitation of the dev URL that would be great!

1
Why does it need to fetch an app from an app? What kind of returned value couldn't be achievied using a library? - Kriggs
Running the code as a web app allows you to choose under which user the code will be running. Using a Library is always the same user (the current one). My circumstances with permissions are quite complex so I absolutely need a way to run the code as a different user than the current one, therefore I'm using a web app. - mTorres

1 Answers

2
votes

your assumption is correct, the dev url ignores your publishing permissions on purpose, only the developer has access to that url.

you could accomplish what you want using libraries. move the code in your called script to a library and add it to that script as "development mode" and publish your script service.

changing library code should also change your service because its on development mode.

Note that this can easily break your app if you save partial code changes, and makes it hard to test your changed code unless you make all changes and tests in a separate script copy. Making several changes at once in multiple apps script editor files is possible with their "Save all" File menu command (after manually pasting all code changes from your tested copy).