How to verify the client customer id is valid and billing has been setup!

356 views
Skip to first unread message

brst...@gmail.com

unread,
Mar 11, 2014, 8:20:44 AM3/11/14
to adwor...@googlegroups.com
hello,

I am currently developing a web application which requires to add existing adwords user account with the MCC account, this has have to be done using adwords api, and i have successfully done this. Now is there any link in adwords api which can verify that the supplied ClientCustomerId has set up the billing and also this ClientCustomerId is valid ?
I am making use of PHP Client Library.

Zweitze

unread,
Mar 11, 2014, 8:47:33 AM3/11/14
to adwor...@googlegroups.com
Just try to create a campaign - that fails when the customerid is wrong, or the billing is not set up. (It also fails when the owner has not agreed with the T&C yet, remember that.)

If it fails the error will point out what's wrong. Otherwise you can go on and delete the campaign again.

brst...@gmail.com

unread,
Mar 11, 2014, 10:48:18 AM3/11/14
to adwor...@googlegroups.com
hello Zweitze,
well thanks ! But i don't agree with you because i have a Client Customer Id for which the billing has not been set up but still i have been able to launch the campaign for that Client Customer Id. There does not seems to any error if the billing has not been set up. please help !!

brst...@gmail.com

unread,
Mar 11, 2014, 10:57:12 AM3/11/14
to adwor...@googlegroups.com

Also i would like to add that the campaign has been launched but it is'nt running because the billing has not been set up. I can see the campaign in the UI after loging with that client customer ID. Also there is a message: "you account is is'nt active. To active please enter billing information!"

Zweitze

unread,
Mar 11, 2014, 1:26:16 PM3/11/14
to adwor...@googlegroups.com
Hmm...

You should be getting a ClientTermsError. Well you could try CustomerService.Get() but I doubt that that will work now...
Maybe the functionality has changed, eg. you can now set up a complete account without having to worry about billing and agreeing with T&C - which is something that someone must do in the AdWords web interface.

Let us know if you find something.

Josh Radcliff (AdWords API Team)

unread,
Mar 11, 2014, 5:07:59 PM3/11/14
to adwor...@googlegroups.com
Hi,

Are you seeing the behavior you described while using a test account or a regular/production account?

Cheers,
Josh, AdWords API Team

brst...@gmail.com

unread,
Mar 12, 2014, 7:48:09 AM3/12/14
to adwor...@googlegroups.com
hello Josh Radcliff,
let me explain everything in detail. The application which i am developing requires to link existing adwords account under my MCC account and also create new accounts under my MCC account.
now lets discuss about

1)  adding existing adwords account under my MCC account.
Here  i am making use of live MCC account whose developer token and user agent has been approved. Now in order to link an existing adwords account i made use of ManagedCustomerService -> ManagedCustomerLink. and send a request with parameter ADD PENDING. Now when i loggedin with the credentials of the user whom i want to link i found an invitation request under Account Settings> Account Access. This looks fine. Now is there any way i can set active on behalf of the user ?? Like i did with the test accounts. I sent first request ADD PENDING and after that another request SET ACTIVE and i found that the user was easily listed under my MCC.

2) creating new adwords account under my MCC account.
Here i made use of ManagedCustomerService.mutate and provided the required parameters and a new account was created under my MCC. Now here i am stuck in a problem of how to set up the billing for this newely created account ?? Which api i would make use to set up the billing ??

Josh Radcliff (AdWords API Team)

unread,
Mar 12, 2014, 11:00:38 AM3/12/14
to adwor...@googlegroups.com
Hi,

For item #1, using OAuth credentials that have permissions to access the AdWords account you should be able to set the invitation to ACTIVE as described here, the same as you did for test accounts.  Is there some reason why you cannot do this with your non-test accounts?

For item #2, the API does not support setting up billing information on an account, so someone will have to use the AdWords UI to enter this information.  The one exception to this is if you are whitelisted for the BudgetOrderService, in which case you can create a BudgetOrder using your billing account.  Please contact your Google Account Manager if you are interested in being whitelisted for this service.

Best regards,
Josh, AdWords API Team

brst...@gmail.com

unread,
Mar 13, 2014, 4:08:08 AM3/13/14
to adwor...@googlegroups.com
Hello Josh,

Well many thanks for you support. Now For Item #1, I have been able to send the request for ADD PENDING and the result was a success, and to confirm i sent the same request and got this error:
An error has occurred: [ManagedCustomerServiceError.ALREADY_INVITED_BY_THIS_MANAGER @ operations[0]] 
So this confirmed that my ADD PENDING request was a success. Now working with the same credentials as used while sending the PENDING request i sent another request SET ACTIVE and got error :
An error has occurred: [ManagedCustomerServiceError.NOT_AUTHORIZED @ operations[0]] .
Now i am not able to figure it out that same credentials worked with the ADD PENDING and the same does not work with this request.
Now please have a look and guide me to get this on track.

Regards,
Brihaspati Dev



Josh Radcliff (AdWords API Team)

unread,
Mar 13, 2014, 9:27:32 AM3/13/14
to adwor...@googlegroups.com
Hi Brihaspati,

When setting the request to ACTIVE you need to use the credentials of the invited (non-MCC) AdWords account, not the MCC account.  The reason for this is that you are attempting to accept the invitation, and only a user with access to the invited account can do that.  A user with access to the MCC account does not yet have access to the invited account so it can't act on behalf of the invited account.

To generate credentials for the invited account you can run the GetRefreshToken.php example, but this time when it gives you a URL to paste into your browser make sure that you are logged in as the invited user when you go to that link and accept.  You can then use the refresh token produced when setting the invitation to ACTIVE.

Cheers,
Josh, AdWords API Team

brst...@gmail.com

unread,
Mar 14, 2014, 2:40:09 AM3/14/14
to adwor...@googlegroups.com

Hello Josh,

Thanks for suggesting me this way but i am finding it difficult because in order to generate the refresh token we have to pass client_id and client_secret which is generated by creating an application on API Console - Google Code and after creating this i have to run GetRefreshToken.php with these parameters->developerToken, userAgent, clientCustomerId, client_id, client_secret and also on command line and then i have to sign in with the invited account user credentials and after that i have to manually copy paste the url to generate a piece of code and then this piece of code is entered again in the command line to generate refresh token and after that i can accept the invitation. I can develop a script which ass the user its client_id, client_secret but this seems to be too complex for a normal user any normal user can't be a developer to do this.
So can you please suggest me in this whole process where am i wrong ??
and also is there any other way other than this i can achieve the results  ??
If not then i am left with only option-> i have to tell invited user to manually login and accept the invitation request sent by the MCC User. Please Suggest !

Regards,
Brihaspati Dev


Josh Radcliff (AdWords API Team)

unread,
Mar 14, 2014, 9:19:42 AM3/14/14
to adwor...@googlegroups.com
Hi Brihaspati,

One important point is that the client_id and client_secret are for your application--the user never creates these.  You should use the same client_id and client_secret for all of your application's OAuth2 requests, as this is what identifies your application.  The OAuth2 flow is meant to authorize a specific application, identified by client_id and client_secret, for access to a user's account in a specific scope (the AdWords scope, in this case).

One way or another, you will have to prompt the user for credentials at some point. For your use case you could create a web application in the console, which will require you to specify a redirect URL. If you use the web application's client_id and client_secret in your OAuth2 requests then instead of having to copy and paste the authorization code as in GetRefreshToken, the redirect URL will receive the authorization code and should then exchange it for a refresh token, which you should store and use for all future requests against that user's account. This flow is described in detail here.

Cheers,
Josh, AdWords API Team

brihaspati techno

unread,
Mar 15, 2014, 5:16:40 AM3/15/14
to adwor...@googlegroups.com
hello Josh Radcliff,

Thanks for clearing my concepts regarding OAuth2. As said by you i have created a web application in the console and made use of the client _id and client_secret in my script which prompts the google login and after the successful login with the invited user a code was returned and using this code i generated the refresh_token and then i replaced this refresh_token in the auth.ini file and sent a request SET ACTIVE and got this error message:

An error has occurred: { "error" : "unauthorized_client" }.

Now after this error i tried replacing the older client_id and client_secret with this new web console application's client_id and client_secret and supplied the new refresh_token then i recieved this error message:

An error has occurred: [AuthenticationError.OAUTH_TOKEN_INVALID @ ; trigger:'']

Below is the response i got after loggin in with the invited user

stdClass Object
(
    [access_token] => ya29.1.AADtN_WaBb9JRj3Wxk0x5zms8FEyX_QgQbDmnqbKYnCq5JaJzbbCXXXXXXXXXX
    [token_type] => Bearer
    [expires_in] => 3600
    [id_token] => eyJhbGciOiJSUzI1NiIsImtpZCI6IjNkNTZlZDFiMDVlOWJlMmQ3ZjM1MTQ2NDc1YzY3ZmYzOTU3ZTNhZTkifQ.eyJpc3MiOiJhY2NvdW50cy5nb29nbGUuY29tIiwiZW1haWwiOiJicnN0ZGV2OUBnbWFpbC5jb20iLCJjaWQiOiI1NDAxODk2NTkxMTguYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJhenAiOiI1NDAxODk2NTkxMTguYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJ0b2tlbl9oYXNoIjoiSkFLMDA0YzkyZzU5bGVBaWpuT1JRQSIsImF0X2hhc2giOiJKQUswMDRjOTJnNTlsZUFpam5PUlFBIiwiYXVkIjoiNTQwMTg5NjU5MTE4LmFwcHMuZ29vZ2xldXNlcmNvbnRlbnQuY29tIiwidmVyaWZpZWRfZW1haWwiOiJ0cnVlIiwiZW1haWxfdmVyaWZpZWQiOiJ0cnVlIiwiaWQiOiIxMDM3ODIzMDY2NjU0Mzk3NDMyNzkiLCJzdWIiOiIxMDM3ODIzMDY2NjU0Mzk3NDMyNzkiLCJpYXQiOjEzOTQ4NzQwMTQsImV4cCI6MTM5NDg3NzkxNH0.VCWA4LVVn5IqNRSjOo4BwvZMzJlxyvWI1hY5ETZiETnfi47LK1V4UOaWEWVp-l24GkuRXMueyLIYHPhP4lGVtqXGX4Ydy6gu9L2ORNzaEPiXQGxSlv-CMJKW2OsQ4FARkv2t_49blHuPgtFwB41QdNOzBYeYSL0feXXXXXXXXXX
    [refresh_token] => 1/z3Jt77RQUJaIsDXq_cd7LvwyNorcl6-XXXXX_XXXXX
    [created] => 1394874309
)

I have replaced some of the characters just to make sure it is not misused.
Please guide me to solve this error.
Regards,
Brihaspati Dev

Josh Radcliff (AdWords API Team)

unread,
Mar 15, 2014, 9:55:17 AM3/15/14
to adwor...@googlegroups.com
Hi Brihaspati,

Please send the actual values and any SOAP logs to me only by clicking "Reply to Author" and I'll investigate on my side.

Thanks,
Josh, AdWords API Team

brihaspati techno

unread,
Mar 18, 2014, 6:59:24 AM3/18/14
to adwor...@googlegroups.com
hello Josh,

As said by you i have sent you the required details. One important thing is that i have generated the refresh_token of the invited user and now how should i make the request on the behalf of the invited user ??
 I mean to say that i have changed the refresh token in the autn.ini file but still receiving‎ the above mentioned error messages. And can you please tell me about how to set the OAUTH values in the function instead specifying them in the auth.ini file ?

Regards,
Brihaspati Dev

brihaspati techno

unread,
Mar 18, 2014, 11:05:58 AM3/18/14
to adwor...@googlegroups.com
hi Josh,

Thanks a lot for looking into this matter. the code snippet you have provided is in JAVA language but i am making use of PHP. Actually the SOAP logs are not recorded for the failed requests since the error occurred so the processing stops there only. The problem i am facing is that i have been able to generate the refresh_token for the invited user, and how to use this refresh_token in order to make the request on the users behalf ??
Like if i make a request for the ADD PENDING service then i have to provide the Client_id, client_secret, developer_token and user agent and refresh_token all there are from the manager's side(MCC account credentials) and the request is a success. Now after this i redirect the user to google login page and after successful login a code is returned back and using that code i have generated the refresh token. Now where to put this token into the script so that the SET ACTIVE request is completed successfully on users behalf ?

Regards,
Brihaspati


On Tue, Mar 18, 2014 at 7:05 PM, <adwor...@googlegroups.com> wrote:
Hi Brihaspati,

Could you send me the request and soap logs for the failed requests?

Another note is that you don't need multiple projects (client_id/client_secret pairs) if you only have one application.  You can (and should) use the same client_id and client_secret for all of your application's requests, regardless of which user's account you are accessing.

Regarding your question on setting the OAuth information programmatically, below is an example.

AdWordsUser user = new AdWordsUser();
user.Config.OAuth2Mode = OAuth2Flow.APPLICATION;
OAuth2ProviderForApplications oAuth =
    (user.OAuthProvider as OAuth2ProviderForApplications);
oAuth.RefreshToken = xxx;
oAuth.AccessToken = xxx;
oAuth.UpdatedOn = xxx;
oAuth.ExpiresIn = xxx;

Note that only oAuth.RefreshToken is mandatory. If you leave oAuth.AccessToken as empty, or if oAuth.UpdatedOn + oAuth.ExpiresIn is in the past, the access token will be refreshed by the library.

Thanks,
Josh, AdWords API Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
 
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@googlegroups.com
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 "AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

brihaspati techno

unread,
Mar 19, 2014, 2:25:38 AM3/19/14
to adwor...@googlegroups.com
Hello Josh,

Sorry for troubling you a little more can you please suggest me any way to use the generated(invited user) refresh_token ??
Its urgent if you can please help me to do this.

Regards,
Brihaspati Dev


Josh Radcliff (AdWords API Team)

unread,
Mar 19, 2014, 12:07:42 PM3/19/14
to adwor...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages