question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

You do not have permission to call showSidebar

See original GitHub issue

To allow this add the next scope to appsscript.json

{
  "oauthScopes": [
    "https://www.googleapis.com/auth/script.container.ui"
  ]
}

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
VAggrippinocommented, Feb 15, 2020

Never mind… The problem is onOpen(). I apparently can’t show any kind of Ui without user interaction: https://issuetracker.google.com/issues/69238694#comment7

2reactions
VAggrippinocommented, Feb 15, 2020

Sure. I appreciate you taking a look.

It works if I run the function from the script editor, but not if I run it from the onOpen() handler.

Here’s the error message in the StackDriver Logging:

Exception: You do not have permission to call Ui.showSidebar. Required permissions: https://www.googleapis.com/auth/script.container.ui
   at onOpen(Code:5:8)

Here’s some very basic sample code recreating the problem:

function onOpen() {
    const html = HtmlService.createHtmlOutputFromFile('Index');
    const ui = SpreadsheetApp.getUi();
    ui.showSidebar(html);
}

and my appsscript.json:

{
  "timeZone": "Asia/Hong_Kong",
  "dependencies": {
  },
  "exceptionLogging": "STACKDRIVER",
  "runtimeVersion": "V8",
  "oauthScopes": [
    "https://www.googleapis.com/auth/script.container.ui"
  ]
}

And the spreadsheet this is bound to is here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error "You do not have permission to call showSidebar" in ...
A short description of the issue: Until this week you can show the sidebar on document open if no extra permissions are needed,...
Read more >
You do not have permission to call showModalDialog
Open any sheet in Google Drive, and get the Workforce Dimensions Admin add-on. Choose "Generate settings file" and get the error message "You...
Read more >
Authorization Scopes | Apps Script - Google Developers
Apps Script automatically determines what scopes a script needs by scanning its code for function calls that require them. For most scripts this ......
Read more >
You do not have permission to call showmodaldialog.
It's work fine, modal dialog pops up. But if i log in with another account, that have permission to edit, trigger throws error:...
Read more >
Dialogs after Edit : r/GoogleAppsScript - Reddit
I would like to show a dialog if a user inputs something "not allowed" ... Execution failed: You do not have permission to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found