Jim
Jim

Reputation: 677

Force asking permission with Apps Script?

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?

Upvotes: 1

Views: 1751

Answers (1)

JSDBroughton
JSDBroughton

Reputation: 4034

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.

Upvotes: 1

Related Questions