Add-on with LIMITED auth cannot open sidebar

I have a Google Docs add-on that is programmed to open the sidebar as soon as the document is open. Of course, this requires the add-in to be installed and included in the document.

I see that from a week the automatic opening of the sidebar, which is very useful in our use case, no longer works.

In StackDriver logs, I see this report:

onOpen(): {authMode=LIMITED, source=Document, user=} publi-2.0.72-2017-11-27-18-57 [this is the publication version tag] 2017-11-27T18:02:50.126Z : show menu 2017-11-27T18:02:50.180Z : show sidebar Error showing sidebar Exception: You do not have permission to call showSidebar 2017-11-27T18:02:50.283Z : end onOpen 

It’s clear that the add-in is in LIMITED mode, and showSidebar () should succeed according to the lifecyle authorization admin (just look at the LIMITED column in the table).

β†’ I suspect that a bug or a new security restriction has recently been detected.

Here's a snippet of code for the record:

 /** * Basic setup. At the beginning: * 1. Add a "Add-ons" menu item. * 2. Display the doxMaster sidebar. */ function onOpen(e) { console.log("onOpen(): ",e) console.log(addonversion); doServerLog("show menu"); showMenu(); doServerLog("show sidebar"); showSidebar(); doServerLog("end onOpen"); } /** * Creates the Add-ons menu at the google drive panel. */ function showMenu() { DocumentApp.getUi().createAddonMenu() .addItem(translate("sidebarMenu"), showSidebar.name) .addItem(translate("joinFollowingParagraph"), insertJoinFollowingParaSymbol.name) .addItem(translate("importDocument"), importDocument.name) .addItem(translate("about"), about.name) .addToUi(); } /** * Creates a doxMaster Add-on Sidebar. */ function showSidebar() { try { var htmlTemplate = HtmlService.createTemplateFromFile('sidebar'); var html = htmlTemplate.evaluate().setTitle(translate("appTitle")); DocumentApp.getUi().showSidebar(html); } catch (e) { console.log("Error showing sidebar ", e); // Add-on has not been enabled in this document } } 
+5
source share
3 answers

I repeated the check and I see that:

  • when installing the add-in, the mode is set to FULL
  • then to open document mode is set to None.
  • when you open the add-in, then closing the document opens, LIMITED mode.

This corresponds to the expected life cycle, except that:

  • CreateTemplate error in LIMITED mode
  • In LIMITED mode, the event has {user =} with no value:

08: 22: 36.457 onOpen (): {authMode = LIMITED, source = Document, user =}

I think the user rights are somewhat lost.

+1
source

Yesterday we noticed the same problem as Yves. However, for us this happens in the Google Sheets addon.

I created a problem on Google: https://issuetracker.google.com/issues/69824548

Please watch and comment for it to rise quickly!

+1
source

From https://developers.google.com/gsuite/add-ons/concepts/editor-auth-lifecycle

Note. Add-ins cannot open sidebars or dialogs when executed in AuthMode.LIMITED. You can use menu items to open sidebars and dialogs, as they are launched in AuthMode.FULL.

0
source

Source: https://habr.com/ru/post/1273690/


All Articles