1

I'm developing an Apps Script that has a sidebar and a dialog, each need differing levels of permissions to ask the user to be granted.

The application needs access to Read/Write the user's Google Drive API, Google Picker, access to Web Cam and Microphone, Web Speech API, and Google Docs API.

How can I get prompt the user once for all permissions needed, instead of having to force the user to launch open the sidebar and dialog once separatelu, each via the add-on menu?

Jim
  • 668
  • 8
  • 22

1 Answers1

1

You can add naked API app calls in the host script to prompt any scopes you will subsequently need. e.g.

var cal = CalendarApp,
    Drv = DriveApp,
    …
    etc.

This will prompt for permission for access to users calendars

The webcam is a different beast however and will depend on a users browser settings and indeed which browser they are using. Chrom, for example, has an option to always prompt for permission to use the webcam.

JSDBroughton
  • 3,966
  • 4
  • 32
  • 52
  • I will try this. I'm okay with the browser prompting for webcam access. The problem I am having is that a button in the sidebar cannot launch the dialog because permissions are blocking, however if I load the dialog via the add-on menu I get prompted to grant permission. Very annoying. – Jim May 03 '16 at 16:26
  • Is the problem that the dialog won't display or something inside the dialog? Are you trying to implement the Google Picker inside the dialog? Are the permissions prompts every time or just twice per user depending on the permissions? – JSDBroughton May 04 '16 at 09:17
  • It seems everything is working. I think the issue was mostly during development - as I made changes, the app would not ask to escalate privileges. This might be a side effect of the way the development of Add-ons. The problem I seem to have been encountering would be I would add a feature that required a certain level of authorization, and then for example add the Utility Service; which would cause the dialog to fail to open. If I go back through the normal workflow, it seems to work. I've not had to deploy an update yet that needs expanded access - so it's possible there's still an issue. – Jim May 05 '16 at 21:15