How to generate refresh token from script?

pooja V1
Mega Guru

Hello All,

I setup OAuth with an external client and created a REST message. created a script include to check whether there is any existing refresh token, if the refresh token is not expired then looks for access token and validates whether it expired or not. If not expired then makes a REST call. If the Access Token expires, then I am generating a new one with the help of refresh token.
But, I am struck at generating Refresh Token when it is expired. 
I need a way to generate Refresh token through script without manually generating from REST Message 'Get OAuth Token' related links.

Can someone please help about how to generate Refresh Token through script?

Below is the script i created for generating Access Token, but not sure how to generate for Refresh token.

 

find_real_file.png

find_real_file.png

Thanks,

Pooja

2 REPLIES 2

Tejas Tamboli
Giga Guru

Hi Pooja,

This is a below script link that I found for a refresh token from Google API

https://developers.google.com/google-ads/scripts/docs/examples/generate-oauth20-refresh-token

Check this if it helps you in do changes accordingly.

 

I hope this will help you.


Mark ✅ Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.

Thanks & Regards
Tejas Tamboli

preethi s
Tera Contributor

I have the same issue. The Google API above is not helping.

Can someone help with this?