MCC Account - Linking Accounts programatically

88 views
Skip to first unread message

Carlos Iriarte

unread,
Nov 17, 2014, 6:08:02 PM11/17/14
to adwor...@googlegroups.com
Hello AdWords API Team,

I am trying to achieve the following scenario through OAuth2 / OpenID Connect:

Our software stack is AspNet MVC 4. Using https://github.com/googleads/googleads-dotnet-lib and I've created an MCC (and the corresponding MCC Test account). I have also registered our app at https://console.developers.google.com

We want our customers to add certain extensions to their ads (and possibly add certain properties on their behalf)

1. The user is logged in to our application (a SaaS web app)
2. We trigger an OAuth2.0 / OpenID Connect web server flow (here we obtain the necessary tokens).
3. We should be able to obtain access to their account programatically and modify the customer's ads accordingly to our business logic.

I'm facing a couple of questions that I've been unable to answer reading through the documentation:

- Do we need to "prelink" each potential account to our MCC?
- Can't we just use the OAuth2 web server flow to access their resources? Without prelinking and authorizing their accounts manually?

From what I've read so far, it looks like we need to add the ClientCustomerId on each request, but it will work only for those accounts linked to our MCC. Are there any workarounds? Can I autolink these new accounts programatically? 

Please let me know if you need more information, I'd be happy to share more details in private.

Thanks,
Carlos

Josh Radcliff (AdWords API Team)

unread,
Nov 18, 2014, 9:56:30 AM11/18/14
to adwor...@googlegroups.com
Hi Carlos,

You do not have to link the client accounts to your MCC, although many developers do this to make it easier -- it allows you to use the same OAuth credentials for requests on all of the accounts under the MCC. However, if you have a mechanism for obtaining OAuth credentials on a per-account basis, that will work as well.

For example, in your use case you could:

1. Use the web or native application flow get a refresh token or access token for a user's account. This will require authorization from the user, either just once if using a refresh token (offline flow) or repeatedly (each time the access token expires) if you are not using the offline flow.
2. In your requests, use:
  a. The developer token from your MCC
  b. The clientCustomerId of the customer's account.
  c. The OAuth access token from step 1

Again, the clientCustomerId (b) does not have to be in your MCC as long as the OAuth credentials (c) grant access to that customer ID (b).

Cheers,
Josh, AdWords API Team
Reply all
Reply to author
Forward
0 new messages