4

I have developed a Google Docs addon that is published to the Google Workplace Marketplace.

But I'm getting this error:

Error Exception: Action not allowed

when trying to access the current active document using this function where the add-on is installed.

var doc = DocumentApp.getActiveDocument();

It works fine in development and testing, but for live users I get this error in the Executions log.

The auth scope related to this functionality is added and approved:

https://www.googleapis.com/auth/documents.currentonly

This scope should be enough to access the document so I don't know what the issue could be.

Happy for any assistance!

Rubén
  • 34,714
  • 9
  • 70
  • 166
ranger
  • 73
  • 3
  • Welcome to [so]. Please add a [mcve]. – Rubén Apr 23 '22 at 20:58
  • Thank you @Rubén for taking time to comment. In order to reproduce the issue one would need to publish an add-on to the Google Workspace Marketplace, since the problem doesn't arise in development or test-mode. It looks like the user is not allowed to access the document even though they have authorized the required scopes on install. Have you experienced something similar? – ranger Apr 23 '22 at 21:49
  • 1
    I think I found the issue. It is related to the multi-user bug for add-ons. I was logged in with two different Google accounts in the same browser. You can read more about the issue here: https://issuetracker.google.com/issues/201559231 – ranger Apr 23 '22 at 22:08
  • Thanks for your replies.. the multiple-account sign-in problem is old known issue... i.e. https://issuetracker.google.com/issues/69270374 is from 2017. Related https://stackoverflow.com/q/50786442/1595451, https://stackoverflow.com/q/54751857/1595451 – Rubén Apr 23 '22 at 22:27
  • By the way, is your add-on an Editor add-on (uses open trigger / custom-menu) or a Workspace Add-on (uses the card service)? – Rubén Apr 23 '22 at 22:32
  • 1
    Thanks for the links @Rubén. I will implement an error message that tells the user to log out of all other Google accounts from the browser, according to this: https://sites.google.com/site/scriptsexamples/home/announcements/multiple-accounts-issue-with-google-apps-script It is an Editor add-on that uses the onOpen trigger. – ranger Apr 24 '22 at 12:50
  • Did avoiding multiple sign-in solve your issue? – ziganotschka Apr 25 '22 at 07:10
  • @ziganotschka I check if there is a multi account issue on startup of the app and give the user a message to log out from the browser, and yes it resolved the issue. – ranger Apr 25 '22 at 10:11

0 Answers0