# Postman and Google Cloud platform private keys

**URL:** <https://community.postman.com/t/postman-and-google-cloud-platform-private-keys/1420>\
**Category:** Help Hub\
**Tags:** tests, authentication\
**Created:** [April 11, 2018, 5:45pm UTC](https://community.postman.com/t/postman-and-google-cloud-platform-private-keys/1420 "2018-04-11T17:45:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pushyamig](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@Pushyamig](https://community.postman.com/u/Pushyamig)\
**Post date:** [April 11, 2018, 5:45pm UTC](https://community.postman.com/t/postman-and-google-cloud-platform-private-keys/1420/1 "2018-04-11T17:45:25Z")

</div>

We have an API endpoint that is running on Google cloud platform and that endpoint writes stuff to Google BigQuery. So we have a never expiring Bearer token that we use to talk to the API endpoint.  
I am writing some automated test using Postman to make API calls to the endpoint and BigQuery as well. So the problem that I am having is Google has something called service account (private key) in form of .json file. So right now I don’t see postman support this for Google cloud platform. So as a workaround using the Google service account I am generating a Bearer token and using that making a query to BigQuery but that token expires in 1 hour and I have to manual generate a token again(`GOOGLE_APPLICATION_CREDENTIALS=~/<path-to-service-accout.json> gcloud auth application-default print-access-token`) to run the automated test. My Question is

1. is there a way using postman app and Google service account( google private keys) I can have my tests run without user intervention?

 ![25%20AM](https://us1.discourse-cdn.com/getpostman/original/3X/f/3/f3fc1f6981073278dbb705904410c0341aa8dd3f.png) ![12%20AM](https://us1.discourse-cdn.com/getpostman/original/3X/c/7/c7229e545bf791c38a1652ebe580bb746a995f91.png)

---

<div class="post-metadata">

**Author:** ![ankit\_chauhan](https://avatars.discourse-cdn.com/v4/letter/a/e495f1/32.png) [@ankit\_chauhan](https://community.postman.com/u/ankit_chauhan)\
**Post date:** [July 9, 2019, 7:40am UTC](https://community.postman.com/t/postman-and-google-cloud-platform-private-keys/1420/2 "2019-07-09T07:40:31Z")

</div>

Hi Pushyamig,  
I have the same use case. May I know whether you found any solution for this?

---

<div class="post-metadata">

**Author:** ![ojacques](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/ojacques/32/2589_2.png) [@ojacques](https://community.postman.com/u/ojacques)\
**Post date:** [August 20, 2019, 8:05am UTC](https://community.postman.com/t/postman-and-google-cloud-platform-private-keys/1420/3 "2019-08-20T08:05:51Z")

</div>

> [@Pushyamig](#):
>
> GOOGLE\_APPLICATION\_CREDENTIALS=~/\<path-to-service-accout.json\> gcloud auth application-default print-access-token

I start my newman collection from a Jenkins pipeline / Jenkinsfile. So, generating the token at the beginning of the pipeline with the above is what works for me. A temporary access token just for the execution of the test suite.

---

<div class="post-metadata">

**Author:** ![affanrashid](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@affanrashid](https://community.postman.com/u/affanrashid)\
**Post date:** [April 3, 2020, 8:11pm UTC](https://community.postman.com/t/postman-and-google-cloud-platform-private-keys/1420/4 "2020-04-03T20:11:59Z")

</div>

could you give an example of how you configure your jenkins pipeline to set GOOGLE\_APPLICATION\_CREDENTIALS and run postman?

I can’t wrap my head around it and am hitting a wall.

---

<div class="post-metadata">

**Author:** ![docking-module-ast23](https://avatars.discourse-cdn.com/v4/letter/d/6a8cbe/32.png) [@docking-module-ast23](https://community.postman.com/u/docking-module-ast23)\
**Post date:** [April 10, 2024, 2:55pm UTC](https://community.postman.com/t/postman-and-google-cloud-platform-private-keys/1420/5 "2024-04-10T14:55:15Z")

</div>

Hi there, did anyone get a handle on this ? I am facing the same situation

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [April 10, 2024, 4:06pm UTC](https://community.postman.com/t/postman-and-google-cloud-platform-private-keys/1420/6 "2024-04-10T16:06:26Z")

</div>

@docking-module-ast23

Can you post a link to the Google documentation you are using for this.

I can’t see this on the main authentication pages.

[Authentication methods at Google | Google Cloud](https://cloud.google.com/docs/authentication)

This also perhaps should have been its own topic. Can you confirm its the same issue as the original poster had?

---

<div class="post-metadata">

**Author:** ![docking-module-ast23](https://avatars.discourse-cdn.com/v4/letter/d/6a8cbe/32.png) [@docking-module-ast23](https://community.postman.com/u/docking-module-ast23)\
**Post date:** [April 10, 2024, 5:38pm UTC](https://community.postman.com/t/postman-and-google-cloud-platform-private-keys/1420/7 "2024-04-10T17:38:44Z")

</div>

Hi Michael, thanks for replying. Yes, the post does capture most of what i am trying to do i.e. there’s an external call being made through an application ( similar to a webhook ), to post messages to PubSub.

For testing purposes, we did it manually i.e.

1. created a Service Account(SA) in GCP, gave it required pubsub roles,

2. downloaded it’s key in GCP env, used CloudShell(GCP) to activate it ( _ **gcloud auth activate-service-account** _) ,

3. then issued another command in CloudShell GCP ( _ **gcloud auth print-access-token** _ ).

4. Using that token, we did 2 things:  
a) Checked connectivity from Postman :  
curl -X GET   
‘[https://pubsub.googleapis.com/v1/projects/PRJNAME/topics/TOPICNAME](https://pubsub.googleapis.com/v1/projects/PRJNAME/topics/TOPICNAME)’   
-H ‘Authorization: Bearer ’   
-H ‘Content-Type: application/json’

b) Published message through Postman :  
curl -X POST   
‘[https://pubsub.googleapis.com/v1/projects/PRJNAME/topics/TOPICNAME:publish](https://pubsub.googleapis.com/v1/projects/PRJNAME/topics/TOPICNAME:publish)’   
-H ‘Authorization: Bearer ’   
-H ‘Content-Type: application/json’   
-H ‘Accept: application/json’   
-d ‘{ “messages”: [{ “data”: “SGVsbG8gV29ybGQhCg==” }] }’  
-H ‘Accept: application/json’

Both 4a and 4b succeeded manually from the POSTMAN command prompt, which is what is mentioned in the above forum’s first topic as well.  
So, trying to figure out how :  
steps 2 & 3 can be automated AND how step 4 can be parameterized
