[英]App Script Go Quickstart modification 401 error
I am trying out this tutorial on Go and App Script and it works perfectly but the moment I modified the code to access a spreadsheet the go part doesn't execute the script but give a 401 error. 我正在尝试使用Go和App Script编写本教程, 并且效果很好,但是当我修改代码以访问电子表格时,go部件不会执行脚本,但会出现401错误。 Here is my go code (basically code from the tutorial but changed a few things for it to 'work' on my app script) http://pastebin.com/28S5tVY2
这是我的执行代码(基本上是教程中的代码,但是将其更改为在我的应用程序脚本上可以“运行”) http://pastebin.com/28S5tVY2
I don't know if I made a mistake when creating credentials for the script (I have redone this severally with no success) or if I missed something while doing the modification. 我不知道在为脚本创建凭据时是否犯了错误(我多次重做都没有成功)还是在修改时错过了某些内容。 Any help will be highly appreciated.
任何帮助将不胜感激。
As suggested by @Mogsdad, I looked into adding scopes. 正如@Mogsdad所建议的那样,我研究了添加范围。 On the target App Script, click on File >> Project Properties >> Scopes to get what scopes you need to add.
在目标应用脚本上,单击文件>>项目属性>>范围,以获取需要添加的范围。 An example of a scope is " https://www.googleapis.com/auth/spreadsheets ".
范围的示例是“ https://www.googleapis.com/auth/spreadsheets ”。
On the Golang code, add the scope like so: 在Golang代码上,如下添加范围:
config, err := google.ConfigFromJSON(b, https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/spreadsheets")
Hope this helps someone :) 希望这对某人有所帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.