Automate GetRefreshToken

24 views
Skip to first unread message

Matt b

unread,
Sep 7, 2017, 2:37:57 AM9/7/17
to AdWords API Forum
Sorry if my question is a bit novice.

I have a web app that uses the adwords API, our token expires and our app breaks until i go back tot he oauth playground insert my scope a generate a new refresh token.

How can i do this automatically, is it by using the getfreshtoken.php ? this is a prompt in terminal where i have to actually enter the API Key and secret. Do i have to keep doing this? 

Vincent Racaza (AdWords API Team)

unread,
Sep 7, 2017, 3:22:26 AM9/7/17
to AdWords API Forum
Hi Matt,

Could you confirm if you are using one of our AdWords API client libraries? If you are using it, then our client libraries automatically refreshes an expired access token based on this guide. For more information regarding web app flow, you can refer here.

If you are not using it, then you need to check if the access token is about to expire and then refresh this token as needed. The OAuth2TokenRefresher.php example provides the functionality to retrieve OAuth2 access tokens and handling refreshing the token if it is about to expire.

Let me know if you have further clarifications. 

Thanks,
Vincent
AdWords API Team
Reply all
Reply to author
Forward
0 new messages