"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.