Hi Lakshmi Thanks for your reply.
Yes, I have seen that documentation. I don't have any problems creating the initial token, but after it has expired how do I created a new one? The flow to create the initial token is currently as follows: * We create an oauth2 redirect URL for the user. * The user then gives permission to our app to access their account. * We then receive a code and we can use fetchAuthToken() to get the refresh_token. Are you saying the user will need to manually give us permission to access their account again? I feel there must be an easier way to do this without the user having to do anything. Thanks Steve On Tuesday, December 7, 2021 at 9:07:33 AM UTC+8 adsapi wrote: > Hi, > > The invalid grant error occurs because of a mismatch of credentials and > tokens. I would recommend clearing the cache and using the newly generated > refresh token. Yes for published status 'Testing' the refresh token expires > in 7 days. For the refresh token expiration scenarios: > https://developers.google.com/identity/protocols/oauth2#expiration > > Generating a refresh token: > https://developers.google.com/google-ads/api/docs/first-call/refresh-token?hl=en > Based on your usecase, you can generate a new refresh token once it is > expired. > *Related links:* > > 1. > > https://stackoverflow.com/questions/63822029/google-api-oauth-2-0-trying-to-get-accesstoken-using-curl > > 2. > > https://developers.google.com/google-ads/api/docs/samples/authenticate-in-desktop-application#php > > 3. > > https://stackoverflow.com/questions/65203323/how-to-get-refresh-token-in-google-oauth-2-0-api-with-php > > 4. > > https://developers.google.com/identity/protocols/oauth2/native-app#exchange-authorization-code > > > Thanks, > [image: Google Logo] > Lakshmi Prathipati > Google Ads API Team > > > > > ref:_00D1U1174p._5004Q2ScPDp: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 "AdWords API and Google Ads 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/576409c4-e296-4bfb-82d4-d321394e75f4n%40googlegroups.com.
