Accept invitation using Google Ads API

293 views
Skip to first unread message

rentca...@gmail.com

unread,
Mar 3, 2021, 7:37:17 PM3/3/21
to AdWords API and Google Ads API Forum
Hello,

I keep getting the following error when trying to accept an invitation for linking an account to our MCC.  I'm trying to link CustomerMCC to our MasterMCC.  I followed the example in https://developers.google.com/google-ads/api/docs/account-management/linking-manager-accounts

What customerId should be used for Client.config.loginCustomerId?

Below is the request and response

Request
-------

Method Name: /google.ads.googleads.v5.services.CustomerManagerLinkService/MutateCustomerManagerLink
Headers: {
  "x-goog-api-client": "gl-dotnet/4.0.30319 gapic/5.0.0 gax/3.1.0+acac8dfe75024cb815497966fe13fc6cb1a1b0ed grpc/2.32.0",
  "developer-token": "REDACTED",
  "login-customer-id": "<CustomerMCC>", <--the account that needs to accept the invitation
  "x-goog-request-params": "customer_id= <CustomerMCC>  "
}

{ "customerId": " <CustomerMCC>  ", "operations": [ { "update": { "resourceName": "customers/CustomerMCC/customerManagerLinks/MasterMCC~ManagerLinkId", "status": "ACTIVE" }, "updateMask": "resourceName,status" } ] }

Response
--------
Headers: {
  "request-id": "xBf-xfdJbhxrBIyfvf_BAg",
  "date": "Thu, 04 Mar 2021 00:00:45 GMT",
  "alt-svc": "h3-29=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"",
  "google.ads.googleads.v5.errors.googleadsfailure-bin": "Cv8BCgJIAhL4AVVzZXIgZG9lc24ndCBoYXZlIHBlcm1pc3Npb24gdG8gYWNjZXNzIGN1c3RvbWVyLiBOb3RlOiBJZiB5b3UncmUgYWNjZXNzaW5nIGEgY2xpZW50IGN1c3RvbWVyLCB0aGUgbWFuYWdlcidzIGN1c3RvbWVyIGlkIG11c3QgYmUgc2V0IGluIHRoZSAnbG9naW4tY3VzdG9tZXItaWQnIGhlYWRlci4gU2VlIGh0dHBzOi8vZGV2ZWxvcGVycy5nb29nbGUuY29tL2dvb2dsZS1hZHMvYXBpL2RvY3MvY29uY2VwdHMvY2FsbC1zdHJ1Y3R1cmUjY2lk",
  "grpc-status-details-bin": "CAcSI1RoZSBjYWxsZXIgZG9lcyBub3QgaGF2ZSBwZXJtaXNzaW9uGsoCCkN0eXBlLmdvb2dsZWFwaXMuY29tL2dvb2dsZS5hZHMuZ29vZ2xlYWRzLnY1LmVycm9ycy5Hb29nbGVBZHNGYWlsdXJlEoICCv8BCgJIAhL4AVVzZXIgZG9lc24ndCBoYXZlIHBlcm1pc3Npb24gdG8gYWNjZXNzIGN1c3RvbWVyLiBOb3RlOiBJZiB5b3UncmUgYWNjZXNzaW5nIGEgY2xpZW50IGN1c3RvbWVyLCB0aGUgbWFuYWdlcidzIGN1c3RvbWVyIGlkIG11c3QgYmUgc2V0IGluIHRoZSAnbG9naW4tY3VzdG9tZXItaWQnIGhlYWRlci4gU2VlIGh0dHBzOi8vZGV2ZWxvcGVycy5nb29nbGUuY29tL2dvb2dsZS1hZHMvYXBpL2RvY3MvY29uY2VwdHMvY2FsbC1zdHJ1Y3R1cmUjY2lk"
}

Fault: {
  "StatusCode": 7,
  "Details": "The caller does not have permission",
  "RequestId": "xBf-xfdJbhxrBIyfvf_BAg",
  "Failure": {
    "errors": [
      {
        "errorCode": {
          "authorizationError": "USER_PERMISSION_DENIED"
        },
        "message": "User doesn't have permission to access customer. Note: If you're accessing a client customer, the manager's customer id must be set in the 'login-customer-id' header. See https://developers.google.com/google-ads/api/docs/concepts/call-structure#cid"
      }
    ]
  }
}

KDJ

Google Ads API Forum Advisor Prod

unread,
Mar 4, 2021, 2:22:37 PM3/4/21
to rentca...@gmail.com, adwor...@googlegroups.com

Hi,

Thank you for reaching out. The customerId used for Client.config.loginCustomerId should be the CustomerMCC account id. It is the account that you would like to accept the invitation to link to your MasterMCC.

Thanks and regards,
Xiaoming, Google Ads API Team
 


Google Logo
Xiaoming
Google Ads API Team
 


ref:_00D1U1174p._5004Q2DKyVu:ref

rentca...@gmail.com

unread,
Mar 4, 2021, 3:19:08 PM3/4/21
to AdWords API and Google Ads API Forum
Hello,

As you can see from the above post I'm using the CustomerMCC for Client.config.loginCustomerId and am getting the "USER_PERMISSION_DENIED error.  Pasted below for easy reference.

Headers: {
  "x-goog-api-client": "gl-dotnet/4.0.30319 gapic/5.0.0 gax/3.1.0+acac8dfe75024cb815497966fe13fc6cb1a1b0ed grpc/2.32.0",
  "developer-token": "REDACTED",
  "login-customer-id": "<CustomerMCC>", <--the account that needs to accept the invitation
  "x-goog-request-params": "customer_id= <CustomerMCC>  "
}

Below is the customerManagerLinkOperation
[ { "update": { "resourceName": "customers/<CustomerMCC>/customerManagerLinks/MasterMCC~ManagerLinkId", "status": "ACTIVE" }, "updateMask": "resourceName,status" } ]

Below is my AcceptInvitation code...

        private string AcceptInvitation(Int64 CompanyMCC, string managerLinkResourceName)
        {
            if (managerLinkResourceName.Length > 0)
            {
                Int64 MasterMCC = Convert.ToInt64(Client.Config.LoginCustomerId);
                Client.Config.LoginCustomerId = CompanyMCC.ToString();

                CustomerManagerLinkServiceClient customerManagerLinkService = Client.GetService(Services.V5.CustomerManagerLinkService);

                CustomerManagerLink customerManagerLink = new CustomerManagerLink()
                {
                    ResourceName = managerLinkResourceName,
                    Status = Google.Ads.GoogleAds.V5.Enums.ManagerLinkStatusEnum.Types.ManagerLinkStatus.Active
                };

                CustomerManagerLinkOperation customerManagerLinkOperation = new CustomerManagerLinkOperation
                {
                    Update = customerManagerLink,
                    UpdateMask = FieldMasks.AllSetFieldsOf(customerManagerLink)
                };

                MutateCustomerManagerLinkResponse response = customerManagerLinkService.MutateCustomerManagerLink(CompanyMCC.ToString(), new[] { customerManagerLinkOperation });
            }

            return "success";
        }

Not sure what I'm missing.

KDJ

Google Ads API Forum Advisor Prod

unread,
Mar 4, 2021, 3:56:10 PM3/4/21
to rentca...@gmail.com, adwor...@googlegroups.com

Hi,

Thank you for reaching out. Have you configured the app with the OAuth credentials? If so, could you please share the complete request and response logs along with the email you used to generate the OAuth credentials via the Reply privately to author option for us to further investigate?



Thanks and regards,
Xiaoming, Google Ads API Team
 

rentca...@gmail.com

unread,
Mar 4, 2021, 5:13:36 PM3/4/21
to AdWords API and Google Ads API Forum
I do not have the option to reply privately to author.  Is there some other way for me to send you the complete request and response logs?

KDJ

Google Ads API Forum Advisor Prod

unread,
Mar 5, 2021, 10:33:55 AM3/5/21
to rentca...@gmail.com, adwor...@googlegroups.com
Hello,

Please email us at googleadsa...@google.com if you are unable to reply privately.

Regards,
Anthony

Google Logo
Anthony
Google Ads API Team
 


ref:_00D1U1174p._5004Q2DKyVu:ref

rentca...@gmail.com

unread,
Mar 5, 2021, 2:27:12 PM3/5/21
to AdWords API and Google Ads API Forum
I have emailed the address provided by Anthony with the complete request and response logs.

KDJ

Reply all
Reply to author
Forward
0 new messages