CLASP本地登录 [英] CLASP Local Login
问题描述
我试图弄清楚如何为我的Google脚本项目设置本地登录文件,以便对其进行设置,以便在自动部署过程中正常工作.
I'm trying to figure out how to set up a local login file for my google scripts project in order to set it up so it'll work in an automated deploy process.
据我所知,clasp login
将在您的主目录中创建一个文件,该文件通过scripts.google.com对您进行身份验证,但该文件不适用于本地登录名,因为它缺少一些属性,例如"project_id" .
As far as I can tell, clasp login
will create a file in your home directory which authenticates you with scripts.google.com, but that file isn't applicable to to local logins because it's missing some properties like "project_id".
在寻找如何创建要使用clasp login --creds {file}
运行的文件时,似乎没有一种直接的方法可以在本地目录中生成其中一个文件,这就是我想要设置部署的方式管道.
When looking for how to create a file to run with clasp login --creds {file}
there doesn't seem to be a straight forward way to generate one of those files in your local directory, which is how I would like to set up my deployment pipeline.
互联网上的大多数文档说,您可以通过导航到GCP项目并导出服务帐户json文件来创建自己的文件,但是我不知道如何知道我的Google脚本项目与哪个GCP项目相关联
Most of the documentation on the internet says that you can create your own file by navigating to your GCP project and exporting a service account json file, but I don't know how to tell which GCP project my google script project is associated with.
我很迷失,不胜感激.
谢谢,
亚历克斯
Thanks,
Alex
推荐答案
为了本地登录,我执行了以下步骤:
In order to log in locally I performed these steps:
在您的项目中,确保它与项目ID相关联 (在旧版编辑器中>资源>云平台项目>设置您的项目ID)
In your project, make sure it's associated with a project id (in the legacy editor > resources > cloud platform project > set your project id)
然后转到 https://console.cloud.google.com/apis/credentials?authuser=0&project=your-project-id ,创建一个Oauth2.0客户ID,然后下载您的客户密码并将其保存在本地
Then go to https://console.cloud.google.com/apis/credentials?authuser=0&project=your-project-id, create an Oauth2.0 clientid, and download your client secret and save it locally
从那里您可以通过运行clasp loging -creds/path/to/file本地登录
From there you can locally log in by running clasp loging -creds /path/to/file
感谢ALE13和错误检索访问令牌:TypeError:无法读取未定义的属性'project_id'
这篇关于CLASP本地登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!