Fixing "Authorization is required to perform that action" Google App Script Add-on

TV - June 22, 2022


This post will talk about an unexpected authorization error for Google App Script add-ons and detail a work around for users that are running into this problem. As of the writing of this article, the issue is still open on Google's issue tracker (see here) but as developers, we still have to inform our users and provide a temporary solution.

As a brief overview of the problem, if a user is signed into multiple Google accounts, and is currently using a non-default account while using the Google App Script add-on, the add-on is throwing an "Authorization is required to perform that action" even though the user did authorize the add-on. See the below Google Cloud Console log explorer screenshot:

Not only have the users of my add-on run into this issue, but when submitting/publishing my Google Sheets add-on to the marketplace, the GSW reviewers are rejecting my add-on due to this issue.

One of the places my code is running into this issue is when trying to run:

"Session.getActiveUser().getEmail();"

Basically any line of code that tries to access functions that requires permissions to be authorized, the add-on will error out and produce unexpected behavior.

Of course, you can handle this but it will severely limit the functionality of the add-on and in most cases, render it unusable.

The work around is to either install the add-on with the "default" Google account or to sign out of all accounts and sign back in with the Google account that installed the add-on effectively making that account the "default" one.

Please see this video below for the reproduction of the issue and then the work around solution.

I was able to get my add-on approved by sending the GSW reviewers a similar video so that they can bypass the issue using the work around solution.

Hope this article helped you.