title: Google Add-on adding menu items in limited mode app scripts
body: <p>We have a addon published in the new google app scripts add on store, but permissions don't seem to work correctly when using the add on in any spreadsheet other than the initial one it is installed in.</p>
  
  <p>I'm seeing an issue where when a new spreadsheet is created and a user selects 'use this add on' from the 'manage add-ons' menu, our menu items don't get populated. For now we've been telling people to remove the add-on and reinstall to force the permissions flow for full permissions.</p>
  
  <p>I looked at the permissions lifecycle guide at <a href="https://developers.google.com/apps-script/add-ons/lifecycle#opening" rel="nofollow">https://developers.google.com/apps-script/add-ons/lifecycle#opening</a> and it appears that our onOpen function should be able to add the menu items in LIMITED permissions mode:</p>
  
  <pre><code>function onOpen(e) {
    var menu = SpreadsheetApp.getUi().createAddonMenu();
    menu.addItem("About OurApp", 'aboutOurApp');
    menu.addItem("Show Sidebar", "showSidebar");
    menu.addToUi();
    Logger.log(e);
    if (e &amp;&amp; (e.authMode == ScriptApp.AuthMode.NONE || e.authMode == ScriptApp.AuthMode.LIMITED)) {
      return; // once user selects a menu item, full permissions should be asked for according to docs.
    } else {
     // we have full permissions - show the sidebar.
      var ui = HtmlService.createHtmlOutputFromFile('Sidebar')
       .setTitle('Our App');
      SpreadsheetApp.getUi().showSidebar(ui);
    }
  }
  </code></pre>
  
  <p>Anyone know what we are doing wrong?</p>