- Create new Service Account in your project: https://console.cloud.google.com/iam-admin/serviceaccounts
- Create a JSON Key for the new Service Account:
- Click on the Service Account Name
- Go to "Keys"
- Click "Add Keys"
- Download the "JSON Key"
- Go to the Cloud Run services overview: https://console.cloud.google.com/run
- Tick the checkbox for all relevant Cloud Run Services
- Ensure the Info Panel on the right is showing. If not, click "Show Info Panel" on the right side of the navigation bar
- Grant the Cloud Run Invoker
(roles/run.invoker)
role to the Service Account
- Create an new environment in Postman
- Add the variable
serviceAccountKey
and insert the JSON contents of the JSON key downloaded in Step 1 - (Optional) If all requests for this environment, go to the same Cloud Run Service, add a variable called
cloudRunUrl
with the Cloud Run URL- This needs to be in the
https://*.run.app
format, custom domains are not supported for authentication - If the individual collections should use different Cloud Run URLs, this variable can be left unset
- This needs to be in the
- Create a new collection in Postman
- Go to "Pre-request Script" in the collection
- Paste the contents of the
preq-request-script.js
of this github repository - (Optional) If you choose to overwrite, or define the Cloud Run service URL in the collection, go to
Variables
and set thecloudRunUrl
to the Cloud Run URL of the service- This needs to be in the
https://*.run.app
format, custom domains are not supported for authentication
- This needs to be in the
- Create a new request in your collection
- Go to "Authorization" in the request
- Select the Type
Bearer Token
- Set Token to
{{accessToken}}
- Set the URL to your Cloud Run Service
- Hit SEND