App Script Go Quickstart修改401错误
App Script Go Quickstart modification 401 error
我正在 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. 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
上试用本教程
我不知道是我在为脚本创建凭据时犯了一个错误(我已经多次重做都没有成功),还是我在进行修改时遗漏了什么。任何帮助将不胜感激。
按照@Mogsdad 的建议,我研究了添加范围。在目标应用程序脚本上,单击文件 >> 项目属性 >> 范围以获取您需要添加的范围。范围的一个例子是“https://www.googleapis.com/auth/spreadsheets”。
在 Golang 代码中,像这样添加作用域:
config, err := google.ConfigFromJSON(b, https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/spreadsheets")
希望这对某人有所帮助:)
我正在 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. 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
上试用本教程我不知道是我在为脚本创建凭据时犯了一个错误(我已经多次重做都没有成功),还是我在进行修改时遗漏了什么。任何帮助将不胜感激。
按照@Mogsdad 的建议,我研究了添加范围。在目标应用程序脚本上,单击文件 >> 项目属性 >> 范围以获取您需要添加的范围。范围的一个例子是“https://www.googleapis.com/auth/spreadsheets”。
在 Golang 代码中,像这样添加作用域:
config, err := google.ConfigFromJSON(b, https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/spreadsheets")
希望这对某人有所帮助:)