Not able to re-use refresh tokens while migrating

72 views
Skip to first unread message

Nenad Pantic

unread,
May 12, 2021, 11:12:16 AM5/12/21
to AdWords API and Google Ads API Forum
Hi, 

I understood that I can still use stored refresh tokens when migrating from Google Adwords to Google Ads as per https://developers.google.com/google-ads/api/docs/migration/carryover

"The requirements for authentication remain the same. The Google Ads API uses OAuth2 for authentication, which requires an access token at the time of the request. You can re-use your existing refresh token, client id, and client secret that were used for the AdWords API without any adjustments."

But we are seeing exceptions like this: 

MethodName: google.ads.googleads.v6.services.CustomerService/ListAccessibleCustomers
Headers: {developer-token=REDACTED, x-goog-api-client=gl-java/11.0.11 gapic/ gax/1.60.1 grpc/1.34.1}
Body:

Response
--------
Headers: null
Body: null
Failure message: null
Status: Status{code=UNAVAILABLE, description=Credentials failed to obtain metadata, cause=com.google.api.client.http.HttpResponseException: 400 Bad Request
{
  "error": "invalid_grant",
  "error_description": "Bad Request"
}
        at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1113)
        at com.google.auth.oauth2.UserCredentials.refreshAccessToken(UserCredentials.java:203)
        at com.google.auth.oauth2.OAuth2Credentials.refresh(OAuth2Credentials.java:157)
        at com.google.auth.oauth2.OAuth2Credentials.getRequestMetadata(OAuth2Credentials.java:145)
        at com.google.auth.oauth2.UserCredentials.getRequestMetadata(UserCredentials.java:281)
        at com.google.auth.Credentials.blockingGetToCallback(Credentials.java:112)
        at com.google.auth.Credentials$1.run(Credentials.java:98)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
}.

Once re-authenticated, (obtained new refresh token, it starts to work without above exception being thrown.



Google Ads API Forum Advisor Prod

unread,
May 12, 2021, 3:02:18 PM5/12/21
to ne...@optily.com, adwor...@googlegroups.com

Hi Nenad,

Thank you for reaching out. Normally you wouldn’t need to change any OAuth setting when you switch from AdWords API to Google Ads API. However, if this does happen, I would suggest you regenerate the OAuth2 credentials by following this guide and make the call again. Give it a try and let us know if the issue persists.

Thanks and regards,
Xiaoming, Google Ads API Team

 

Google Logo
Xiaoming
Google Ads API Team
 


ref:_00D1U1174p._5004Q2HALPD:ref
Reply all
Reply to author
Forward
0 new messages