Given you already have a Cloud Run instance with Authenticated Access running, follow the steps below:
- Create service account with per-service permissions (Service Identity, Authenticating Developers)
- Download API key JSON (Create and manage keys)
- Create python environment and install dependencies
python -m venv env
source ./env/bin/activate
pip install -r requirements.txt
- Run the token generator script
python run.py --url=[FULL_API_ENDPOINT] --credentials=[CREDENTIALS_JSON_FILE_PATH]
where FULL_API_ENDPOINT is the full path, including the endpoint (without the query params), i.e. https://my-service-jfkie.a.run.app/my-service-endpoint
, and CREDENTIALS_JSON_FILE_PATH is a full path to the file downloaded in step 2 (i.e. /Users/jon.do/Downloads/my-credentials.json
).
Read more info in Official Docs.