Share a Google App Script to other users - permission requested & authorize script

女生的网名这么多〃 提交于 2020-08-27 09:02:16

问题


I've created a spreadsheet with some GAS behind it that opens a form with some inputs, and now I need to deploy the webapp and share it to some other users. The problem is that when the other users try to open the spreadsheet (shared in Google Drive), they get this error message:

enter image description here

I've already tried to:

  1. Share the spreadsheet to the user/s (Adding the user/s email address with permission Can edit)
  2. Deploy the webapp settings with the following settings:

enter image description here

As you can see, the setting screen reports "You need to authorize the script before distributing the URL".

How can I authorize the script? I can't find a way to do that. Do you know if there's another way to share and let other users run the script?


回答1:


The problem is you are mixing web app with ui dialog on a sheet.
The webapp is accesed from the webapp url (given when you publish the webapp).
The ui dialog is a window shown on top of the spreadsheet.
You want to use webapp, follow the tutorial for that. Publish it to be accesed from the domain if all users are in the same gapps domain. Else use public anonymous.
Run doGet before publish to authorize. Its also possible to do the other ui-on-sheet but you need more steps for each user to authorize.




回答2:


Since you selected to execute the app as you, you need to authorize this script first.

Just select method doGet and press run in the editor, you will get the chance to authorize.




回答3:


You need to manually verify that your script has access to the document.

Add a function to your script that accesses the document:

function doInstall() {
   var mysheet = SpreadsheetApp.openById('x4535khxxhidh...');
}

In script-editor select: Run->doInstall (Or what ever you call your function) when you should be asked to verify that the script is authorized to access the document.




回答4:


The following worked for me:

  1. Go to «Publish»
  2. Click on «Deploy as web app»
  3. Click on «Disable web app» (in case you have published it already)
  4. Execute the Script clicking on «Run»
  5. Authorize the Script and grant permissions with your account
  6. Again, go to «Publish» and click on «Deploy as web app»
  7. Add another «Project version» (in case you have published it already)
  8. Change «Who has access to the app:» to «Anyone, even anonymous» as needed


来源:https://stackoverflow.com/questions/24634258/share-a-google-app-script-to-other-users-permission-requested-authorize-scri

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!