I work a lot with AppsScript in my workplace. I created many custom threads OAuth2.0in a Script application that allow the application to call the REST APIs, and I also worked with the included “built-in” API interaction objects (GmailApp, CalendarApp, etc.). If you enable any of the built-in APIs, the script editor will add the appropriate areas to the project information and then ask the user to get permission to interact with these APIs when the web application first loads.
If I need to interact with both the REST API and several built-in objects of the API call, the user must first grant permission to the built-in areas of the API, then there must be a separate thread OAuthfor the REST API.This leads to a really ugly user.
Is there a way to add REST API areas to the list of areas in the project information, so when the user first loads the application, he will ask for permission for all areas that the project will need? Then I could get the oauth user token from the script session using ScriptApp.getOAuthToken()and use it in all external REST API calls.
EDIT (~ 12: 00: 05 18 / DEC / 15):
Please note: I already know how to enable the API through the Project Console Project associated with the AppsScript project - I want to find a way to add ALL APIs that are included in the Scripts properties, so when the user starts the application, it asks them to grant access permission to all included APIs on their behalf (even REST apis), so I don’t need a second manual OAuth stream / token for the REST API.
EDIT (~ 14: 00: 08 18 / DEC / 15):
I also explored the import / export options in Drive described here:
https://developers.google.com/apps-script/import-export
and cannot find a way to change the areas (or provide any areas) for the project, this way .
source
share