Google Apps Script: AuthMode gets confused w/ mult

2020-04-20 03:49发布

问题:

I'm bumping into a weird problem in Google Apps Script, working on a Slides add-on.

When I run the add-on in an incognito window with just one user logged in (call it User B), everything works fine.

When I run the add-on with multiple users logged in (call it Users A and B in the same Chrome tab), it seems like Apps Script gets confused around the authorization. When I try to use the add-on as User B (as evidenced by the profile showing up in the upper right corner), all functionality of the add-on fails, I'm guessing because it lacks authorization. Note that the add-on has remain installed on User B's account this whole time, and it still works in the incognito window with just User B logged in.

Any tips on this? Is there a way to "force" the add-on to use the authorization of User B in the multi-logged-in case?

回答1:

Having multiple log-ins active in the same browser is known to cause issues with Google Authorization.

The default account (typically the account that was first logged into) takes precedence over any other accounts. Google has yet to fully resolve this. Current work-around is to recommend to your users to log out of all other accounts.