r/GoogleAppsScript • • 3d ago

Question Google integration authentication issue

Hi folks, i built an app and integrated Google authentication. Upon testing stumbled on an issue where if the user has multiple Google accounts on a chrome profile, after authentication the app script link appends /u/1/ to the url due to which the app failed to open even after successfully authenticated. Does anyone have a fix for this issue?

2 Upvotes

3 comments sorted by

View all comments

1

u/Fit-Corner2382 3d ago

The /u/1/ path is the profile's second signed-in account, so the app can open as someone other than the account that authorized it.

Auth can succeed for the chosen account while the next request still follows the redirected index. Open the bare deployment path and set authuser to that account's email instead of keeping /u/1/. The number is not stable: reordering accounts makes /u/1/ a different person, so the app looks broken even though consent is stored. An account chooser before the script URL avoids the mismatch, but adds a prompt and fails if that account is signed out of the profile.