Search code examples
google-apps-scriptweb-applications

Web app asking user to login, even though its been deployed to be used by "Anyone, even anonymous"


I've deployed a script to be used as a web app that can be accessed by "Anyone, even anonymous" and yet, if a user has not logged into a gmail account on a particular browser, its asking them to login.

Here's my manifest file -

{
  "timeZone": "Asia/Kolkata",
  "dependencies": {
  },
  "webapp": {
    "access": "ANYONE_ANONYMOUS",
    "executeAs": "USER_DEPLOYING"
  },
  "exceptionLogging": "STACKDRIVER"
}

To replicate the problem, you can visit the following link by logging out of your gmail accounts (or in a browser that does not have your gmail sign in) -

https://script.google.com/macros/s/AKfycbyayXeY_LGm7sy-J1VGvg7wfqOZYonZmKphS0F4Qz4jLZ336qsR/exec/test*

*it is required that you not change the pathInfo of the URL

Current behavior -

  1. When signed in: You will be redirected to https://www.google.com/
  2. When signed out: You'll be asked to login to your Google acc.

I'm building (or rather, though I already had built) a URL shortener service using Apps Script and oddly, it is not asking users to login when accessed from a custom domain (an iframe embedded in https://tmt.pw) but it is asking them to login once they shorten the URL and try visiting the shortened URL.

The original resources are all available here -

I've tested this on Chrome, Safari and Firefox (all on a Mac) and they all exhibit the same behavior.

I'm guessing this is something very fundamental and all I want is the web app to not ask users to login, given that it has been instructed to execute even for an anonymous user.

Edit note1

The script has some business with a Spreadsheet as well and so I tried making the sheet publicly editable by everyone (anyone on the internet) and it still didn't work.

Edit note2

Was using 1 private function (with an _ at the end of the function name) & have stopped doing that in my script - still no change; problem persists.


Solution

  • Adding the parameter in the path after the /exec triggers the login after the redirect. Using the queryString will probably work.