OAuth库项目密钥:Mnt39sDQPQvSd3QGZFFLcznt7vnFOnL 融合表库代码 融合表库项目密钥:MigHa1npbg9PnkaJ8jFENSyUlmcxk5wr2 出现错误的简化的WebApp:已发布的WebApp ((下面的代码) var oAuthFields = {'clientId':'{...}','scope':'https://www.googleapis.com/auth/fusiontables','fetchUrl':'https://www.googleapis.com/fusiontables/v1/','clientSecret':'{...}','fusionId':'{...}','service':'fusiontables','queryUrl':'https://www.google.com/fusiontables/api/query'};函数doGet(){var app = UiApp.createApplication();var tempVar = FTL.fusionRequest('GET','SHOW TABLES',oAuthFields);Logger.log('Result:'+ tempVar);app.add(app.createLabel('Success'));返回应用程序;} 例外 现在,让事情变得更加有趣,如果我将OAuth库的共享"设置从具有链接可以查看的任何人"更改为具有链接可以编辑的任何人",则一切运行正常.我显然不希望拥有我的库的通用编辑权,所以我一直坚持为什么会发生这种情况,以及修复该问题所需要做的事情.我不清楚在使用库时如何考虑执行为"和共享"设置.我希望任何人都可以访问webApp,并以用户身份执行,并且我将以编程方式实施访问限制.解决方案我已将其识别为GAS库中的更新传播错误.我已此处提交了一个问题问题跟踪器.Background / SummaryI have been using libraries extensively and I am now getting my permissions setup so I can distribute the app to some users for testing. Unfortunately, it's being very unpredictable. I've simplified the problem as follows:I have a simple webApp that is making a simple API call to a fusion table. It calls a function in my Fusion Tables Library. The function in my Fusion Table Library also uses a function from my OAuth Library. This process has worked perfectly when executing from my primary gmail account (to which all resources belong). However, I am now setting up the permissions and it will not work from another account. When executing this webApp from another account, I get the following error (except under one scenario, described later):Detail & ResourcesI am using Google's oAuthConfig class which defaults me to OAuth1.0.Permissions are set as follows:webAppExecute as: user accessing the webAppWho has access: anyonesharing: Anyone who has the link can viewFusion Table LibraryExecute as: user accessing the webAppWho has access: anyonesharing: Anyone who has the link can viewOAuth LibraryExecute as: user accessing the webAppWho has access: anyonesharing: Anyone who has the link can viewMy OAuth Library CodeOAuth Library Project Key: Mnt39sDQPQvSd3QGZFFLcznt7vnFOnLFusion Table Library CodeFusion Table Library Project Key: MigHa1npbg9PnkaJ8jFENSyUlmcxk5wr2The simplified webApp that reproduces error: Published webApp (code below)var oAuthFields = { 'clientId' : '{...}', 'scope' : 'https://www.googleapis.com/auth/fusiontables', 'fetchUrl' : 'https://www.googleapis.com/fusiontables/v1/', 'clientSecret' : '{...}', 'fusionId' : '{...}', 'service' : 'fusiontables', 'queryUrl' : 'https://www.google.com/fusiontables/api/query'};function doGet() { var app = UiApp.createApplication(); var tempVar = FTL.fusionRequest('GET', 'SHOW TABLES', oAuthFields); Logger.log('Result: ' + tempVar); app.add(app.createLabel('Success')); return app;}ExceptionsNow to make matters more interesting, if I change the "sharing" settings of the OAuth Library from 'Anyone who has the link can view' to 'Anyone who has the link can edit', everything works perfectly. I obviously do not want universal editing rights to my library so I am stuck on why that happens, as well as what I need to do to fix it.I am not completely clear on how the 'execute as' and 'sharing' settings are taken into account when using libraries. I am hoping to have the webApp accessible by anyone, executed as the user, and I will implement access restrictions programmatically. 解决方案 I have identified this as an error with update propagation in GAS libraries. I have submitted an issue here to the issue tracker. 这篇关于GAS库和WebApp权限[ReferenceError:"service"没有定义.]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-14 21:35