Hello!
I'm currently working on the migration of a service that uses google
Adwords API. I need to migrate from this API to Google Ads API, because the
first one is being deprecated.
We have many clients with their Google Ads accounts and we get their
corresponding refresh tokens with their consent to make operations (oauth).
Using the Java SDK, when we need to make a request on behalf of our clients
Google Ads account, we instanciate a session according to this code:
API_CONFIG = (
{OUR_CLIENT_REFRESH_TOKEN}, //This changes with different client
accounts
{APP_CLIENT_ID},
{APP_CLIENT_SECRET},
{CLIENT_GOOGLE_ADS_ACCOUNT_ID}, //This changes with different client
accounts
{USER_AGENT},
{DEVELOPER_TOKEN}
);
// Generate a refreshable OAuth2 credential.
Credential oAuth2Credential =
new OfflineCredentials.Builder()
.forApi(OfflineCredentials.Api.ADWORDS)
.from(API_CONFIG)
.build()
.generateCredential();
// Construct an AdWordsSession.
session = new
AdWordsSession.Builder().from(API_CONFIG).withOAuth2Credential(oAuth2Credential).build();
But with the new API (Google Ads API) I could not find how to replicate
this. I mean, using the oauth credentials generated from an account's
refresh token.
Is it possible to do the same thing with Google Ads API? I came across this
code snippet on the account management section of the docs
<https://developers.google.com/google-ads/api/docs/account-management/listing-accounts>
// Optional: Change credentials to use a different refresh token, to
retrieve customers
// available for a specific user.
//
// UserCredentials credentials =
// UserCredentials.newBuilder()
// .setClientId("INSERT_OAUTH_CLIENT_ID")
// .setClientSecret("INSERT_OAUTH_CLIENT_SECRET")
// .setRefreshToken("INSERT_REFRESH_TOKEN")
// .build();
//
// client = client.toBuilder().setCredentials(credentials).build();
Apparently, this seems to be doing the same trick, but it is stated that
few requests can be done with this setting. I tried getting the user_list
of an account and I'm getting a PERMISSION_DENIED error.
I understand that to achieve this with the Google Ads API I need to have
our client's accounts linked to our Manager account. Doing that works
alright. But the question is, is it possible to do it the Adwords API way?
Using our client's account refresh tokens?
Thanks in advance for your help!
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/9ba93f59-decc-4d01-bb24-fd7747668fa2n%40googlegroups.com.