You had stated: "The refresh token generated in the Google Oauth Playground 
lasts only for 1 hour then it expires." This appears incorrect. We 
generated one with our Client ID and Client Secret and it has lasted for 
several hours now.

We also read your doc...

https://developers.google.com/identity/protocols/oauth2#expiration

...about Refresh Token Expiration and none of those bullet items applied to 
our situation. It just expired on its own suddenly for no reason, no email 
to us, no alert in Google Adwords management dashboard.

We also looked at the oAuth Consent Screen. We see nothing about 
"publishing status". Screenshot: https://www.screencast.com/t/6YNeTt1U . 
Also, when we click Edit App, we also don't see anything about a publishing 
status either.

On Wednesday, July 27, 2022 at 3:02:11 AM UTC-4 adsapi wrote:

> Hi Mike,
>  
>
> Thanks for reaching out to the Google Ads API team. I hope you are doing 
> well today.
>  
>
> Please see my response to your question below.
>  
>
> 1.) can we automate this somehow? I can trap the invalid_grant JSON 
> response and then would like to do some series of REST API calls to 
> generate a new Refresh Token.
>
>  
>
>    - The refresh token generated in the Google Oauth Playground lasts 
>    only for 1 hour then it expires. Also, since you mentioned that you’re 
>    getting error with access tokens and refresh tokens after few API calls, 
>    you may refer to this document 
>    <https://developers.google.com/identity/protocols/oauth2#expiration> to 
>    read more information about refresh token expiration. Also, if you set the 
>    publishing status to "Testing" so the refresh token expires every 7 days 
>    and receives an “invalid_grant” error. That being said, please go to the 
>    Google API Console and navigate to the OAuth consent screen and then 
> change 
>    the publishing status to “In production” to avoid the refresh* token 
>    expiring in 7 days*. You may regenerate refresh tokens by referring to 
>    this *guide* 
>    
> <https://developers.google.com/google-ads/api/docs/first-call/refresh-token> 
> for 
>    the steps on how you can regenerate credentials and refresh tokens. 
>
>  
>
> 2.) On the tail end of this request, to fully automate this Refresh Token 
> renewal, do you think that I may need to generate a Service Account instead 
> of doing it the Web Application oAuth Client technique?
>
>    - For this question, we strongly recommend using OAuth2 desktop app or 
>    web app flow 
>    
> <https://developers.google.com/google-ads/api/docs/oauth/cloud-project#choose_an_application_type>
>  instead 
>    of service accounts unless you need a domain-specific feature (for 
> example, 
>    impersonation). OAuth2 desktop app and web app flows do require an initial 
>    user interaction for granting access to the account, but are much simpler 
>    to set up. 
>    - For the OAuth2 desktop app flow 
>    
> <https://developers.google.com/google-ads/api/docs/oauth/cloud-project#desktop>,
>  
>    you can persist a refresh token (which never expires) to obtain a new 
>    access token whenever necessary. When using one of our client libraries 
>    <https://developers.google.com/google-ads/api/docs/oauth/client-library>, 
>    you can authorize your app by filling out a configuration file. 
>
>
> Let us know if you have further questions.
>
>
> Regards,
> [image: Google Logo] 
> Darwin 
> Google Ads API Team 
>   
>
> ref:_00D1U1174p._5004Q2d1nfG:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/e8e69a2b-2cdf-46c1-91de-621ca02cd5c3n%40googlegroups.com.
  • Ho... Mike M
    • ... Mike M
      • ... Mike M
        • ... Mike M
          • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
            • ... Mike M
              • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to