# Refreshing Access Token (Google Ads API)

**URL:** <https://community.postman.com/t/refreshing-access-token-google-ads-api/11016>\
**Category:** Help Hub\
**Created:** [February 26, 2020, 12:27am UTC](https://community.postman.com/t/refreshing-access-token-google-ads-api/11016 "2020-02-26T00:27:54Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![james4peace](https://avatars.discourse-cdn.com/v4/letter/j/ac8455/32.png) [@james4peace](https://community.postman.com/u/james4peace)\
**Post date:** [February 26, 2020, 12:27am UTC](https://community.postman.com/t/refreshing-access-token-google-ads-api/11016/1 "2020-02-26T00:27:54Z")

</div>

Hi there,

I’m trying to use the new Google Ads API.

It’s using OAuth2.0 and requires an Access Token that expires after 60 minutes.

To refresh it, I need to make an API call, providing my OAuth2.0 credentials and a Refresh Token (that I got the last time I called for a new Access Token).

I’ve tried to do this using the “Get New Access Token” form in Postman, but there doesn’t appear to be an option for the refresh token.

I’ve been looking in the documentation & YouTube channel, but it’s escaped me!

Would really appreciate being pointed in the right direction.

Thank you.

---

<div class="post-metadata">

**Author:** ![john-paul](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/john-paul/32/919_2.png) [@john-paul](https://community.postman.com/u/john-paul)\
**Post date:** [February 27, 2020, 1:12am UTC](https://community.postman.com/t/refreshing-access-token-google-ads-api/11016/2 "2020-02-27T01:12:01Z")

</div>

Hi @james4peace!

There’s a blog post on Medium about automating this flow via pre-request scripts:

> **[How to Automate OAuth2 Token Renewal in Postman](https://allenheltondev.medium.com/how-to-automate-oauth2-token-renewal-in-postman-864420d381a0)**
>
> Discover how to automatically renew your OAuth2 access token in Postman so you never have to click the “Get New Access Token” button again.

Hope that helps!

---

<div class="post-metadata">

**Author:** ![james4peace](https://avatars.discourse-cdn.com/v4/letter/j/ac8455/32.png) [@james4peace](https://community.postman.com/u/james4peace)\
**Post date:** [February 28, 2020, 2:18pm UTC](https://community.postman.com/t/refreshing-access-token-google-ads-api/11016/3 "2020-02-28T14:18:33Z")

</div>

Hi John-Paul,

I very much appreciate you finding that article… it looks perfect.

Quick question… it’s using a variable “Basic\_Auth” and the article says:

“… you can use this variable to pass in a basic authentication header with your Client Id and Client Secret”

Is there documentation on how to create such a header and give it a variable name?

Thank you

---

<div class="post-metadata">

**Author:** ![john-paul](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/john-paul/32/919_2.png) [@john-paul](https://community.postman.com/u/john-paul)\
**Post date:** [March 3, 2020, 7:06pm UTC](https://community.postman.com/t/refreshing-access-token-google-ads-api/11016/4 "2020-03-03T19:06:20Z")

</div>

No problem!

In this tutorial, it looks like the Basic\_Auth is a [Collection variable](https://learning.postman.com/docs/postman/variables-and-environments/variables/#defining-collection-variables).

To add a header with a variable value, simply add a header to your request and for the value add `{{variableName}}`. If you want Basic\_Auth to end up in the header, then set the value to `{{Basic_Auth}}`.

---

<div class="post-metadata">

**Author:** ![james4peace](https://avatars.discourse-cdn.com/v4/letter/j/ac8455/32.png) [@james4peace](https://community.postman.com/u/james4peace)\
**Post date:** [March 4, 2020, 1:30am UTC](https://community.postman.com/t/refreshing-access-token-google-ads-api/11016/5 "2020-03-04T01:30:37Z")

</div>

Hi Jean Paul,

Thank you for that…

The thing that confuses me is that it’s saying that the Basic Authentication Header should include my OAuth2.0 Client ID and Client Secret. How do I group these two strings into a single variable (“Basic Oauth”).

Secondly, the demo is using: ‘Authorization’: pm.variables.get(“Basic\_Auth”)

Unless I’m mistaken, is this not for getting a Local Variable? If it was a Collection Variable, would it not have to state: pm.collectionVariables.get… ?

[https://learning.postman.com/docs/postman/variables-and-environments/variables/](https://learning.postman.com/docs/postman/variables-and-environments/variables/)

---

<div class="post-metadata">

**Author:** ![john-paul](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/john-paul/32/919_2.png) [@john-paul](https://community.postman.com/u/john-paul)\
**Post date:** [March 5, 2020, 12:58am UTC](https://community.postman.com/t/refreshing-access-token-google-ads-api/11016/6 "2020-03-05T00:58:39Z")

</div>

Hmm, I’m not sure why it’s saying that to be honest…let me check with our team and see if I can come up with a different example of doing this.

`pm.variables.get()` can be a little misleading. It gets a variable value from whatever the narrowest scope is, it’s not limited to local only. In other words, if I have `variable1` as a global, and an environment variable, it will return the environment variable value.  
[https://learning.postman.com/docs/postman/variables-and-environments/variables/#variable-scopes](https://learning.postman.com/docs/postman/variables-and-environments/variables/#variable-scopes)

---

<div class="post-metadata">

**Author:** ![ajl](https://avatars.discourse-cdn.com/v4/letter/a/c37758/32.png) [@ajl](https://community.postman.com/u/ajl)\
**Post date:** [June 4, 2020, 3:36pm UTC](https://community.postman.com/t/refreshing-access-token-google-ads-api/11016/7 "2020-06-04T15:36:14Z")

</div>

Hi @john-paul and @james4peace,

Did you ever get this sorted? I am running into the same issue where I am trying to get the refresh access token using Google APIs and used the Medium article mentioned as a base. The {{Basic\_Auth}} part is also tripping me up.
