我正在尝试关注 this指南,但是尽管我是 GCP 项目的所有者,但我无法单击步骤 1 中的按钮,因为该行为已被我的雇主禁用。在这种情况下,没有可遵循的替代说明。我尝试假设该按钮将执行的操作是:启用 Google Sheets API,然后创建和下载客户端凭据并保存为 credentials.json
。
但是在 code given in step 3 的第 43 行credentials.installed 被调用,但是我为我的 GCP 项目创建的客户端凭证没有“已安装” key 。我想要有关如何创建正确的 credentials.json
文件的详细说明。
最佳答案
这是 credentials.json 文件需要的样子:
{"installed":{"client_id":"XXX","project_id":"XXX","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"XXX","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}
请用您的数据替换 client_id
、project_id
和 Client secret
的 XXX
。
如果您能够访问 API console ,您应该能够在那里检索这些凭据,否则请您的管理员为您做这件事。
关于javascript - Google Sheets API Node 客户端库最小示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59284034/