How is everyone handling the dreaded Authuser=0 (multiple accounts) bug in Apps Script add-ons?
Hey everyone,
I wanted to open a discussion on handling one of the most notorious and frustrating limitations in Google Apps Script add-on development: the multiple accounts Authuser=0 trap.
The Context: My team recently launched a Workspace management add-on. Shortly after launch, we onboarded an enterprise client who left a great review but immediately reported a frustrating "nitpick": he's logged into multiple Google Workspace accounts, while he's accessing the add-on with his second logged account, the sidebar of our add-on was selecting the default account of their browser rather than the account actually linked to the active spreadsheet.
After consulting with my lead dev, we realised we were dealing with a platform-level infrastructure issue, and not a bug in our code.
The Trap: As most of you know, when a user is juggling multiple Google accounts in one Chrome window (e.g., u/0/, u/1/), Google Apps Script's HtmlService often gets completely confused by the session cookies. If they open the sheet with a secondary account, the underlying iframe still forces the add-on to authenticate using the Default account (authuser=0).
The result is massive user confusion, as the sidebar displays data or permissions for the completely wrong account.
No Workaround Found: We searched high and low but couldn't find a native programmatic patch to force the iframe to respect the active document's user context. So we advised the client to perform their admin operations inside a dedicated Chrome Profile or an Incognito window.
My Questions for the Community: Since we want to provide the smoothest UX possible, I’m curious how other devs here are tackling this:
- The "Holy Grail" Fix: Has anyone found a reliable native workaround, undocumented parameter, or JS hack to force
HtmlServiceto respect the activeauthuserindex? - User Experience (UX): Do you preemptively warn users about this in your UI/onboarding flow, or do you just document it in your FAQs and wait for the support tickets to roll in?
- Google's Roadmap: Has anyone who talks to Googlers heard any whispers on whether this is ever getting patched at the infrastructure level?
Would love to hear your thoughts, workarounds, and war stories regarding this bug!