0

When you add this scope inside oauthScopes section in your appscript.json file:

  "oauthScopes": [
    "https://www.googleapis.com/auth/script.webapp.deploy",
  ]

you will see something like this when you attempt to use the addon:

enter image description here

As I understand, this scope will allow the developer to deploy the addon as a web app (a separated web app for each addon user, not the only web app when we Deploy as web app manually in the script editor)


My question is how to actually use this scope to "Publish this application as a web app" ?

I mean in code it must be ScriptApp.deployWebApp(...) or something like that, right?

But I can't find anything here https://developers.google.com/apps-script/reference/script/script-app

Rubén
  • 34,714
  • 9
  • 70
  • 166
0xh8h
  • 3,271
  • 4
  • 34
  • 55
  • 2
    AFAIK it is possible to programmatically publish a Google Apps Script web app by using Google Apps Script REST API / CLASP but I didn't dig into it yet. – Rubén Aug 07 '19 at 03:28
  • Thanks @Rubén, I will try to dig into the path REST API / CLASP – 0xh8h Aug 07 '19 at 03:29
  • The reason I want to do it is that now I do not only need to update spreadsheet (in my previous question) but also need to send email **from user account**. And manually deploy Web app and Execute the app as: "User accessing the web app" doesn't work because in that case, I need to give access of the script project to the user – 0xh8h Aug 07 '19 at 03:42
  • 2
    To send an email from the user account use MailApp or GmailApp. There is no need to give access them to the script project for that, just set the permissions to execute as the user that is running the web app. Another alternative is to use the Gmail API and OAuth. – Rubén Aug 07 '19 at 04:59
  • 1
    AFAICS, Add-on is a single project used by multiple users. So, even if you deploy as a web-app(using [tag:google-apps-script-api]), you'll only get a single url for all users. But I haven't tested it either. – TheMaster Aug 07 '19 at 05:16
  • @Rubén: yes I know. But if I do that, the person who accesses the web app must log in/authorize so the web app will send mail as him. But I don't want that person to have to log in. I want to send email from quotas of the user who installed the add-on (this user only need to authorize **once** when installing the add-on). I know this is tricky but another team had done it with their product. Anw, thank you for your help. – 0xh8h Aug 07 '19 at 06:33

1 Answers1

2

I am afraid it currenty is not possible. Ass see in ScriptApp.Service class, you can only disable Web app for script, read their URL, but create new one.

Jakub Bouček
  • 1,366
  • 10
  • 15