CLASP Local Login

一世执手 提交于 2020-05-15 06:52:05

问题


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.

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".

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.

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.

I'm super lost, any help would be appreciated.

Thanks,
Alex


回答1:


In order to log in locally I performed these steps:

In your project, make sure it's associated with a project id (in the legacy editor > resources > cloud platform project > set your project 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

From there you can locally log in by running clasp loging -creds /path/to/file

Thanks to ALE13 and Error retrieving access token: TypeError: Cannot read property 'project_id' of undefined



来源:https://stackoverflow.com/questions/60838607/clasp-local-login

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!