Hello,

You can pick from one of the two options depending on what you need.

*Option 1*

   - *Use Case:* You want to store your *clientCustomerId* in your 
   web.config, and you want to retrieve it at runtime.
   - *Solution:* Check out this wiki post 
   
<https://github.com/googleads/googleads-dotnet-lib/wiki/Getting-Started#user-content-configuring-the-ads-user-instance-at-runtime>
 on 
   configuring the ads user instance at runtime.  If you have the 
   *clientCustomerId* set in web.config, you can create a new *AdWordsUser* 
that 
   will contain the *clientCustomerId* from the web.config. Here's an 
   example:

// Create a default AdWordsUser instance. If any configuration is available 
in web.config, that configuration will be used.
AdWordsUser user = new AdWordsUser();

// Retrieve the client customer id.
AdWordsAppConfig config = (AdWordsAppConfig) user.Config;
String clientCustomerId = user.Config.clientCustomerId;


*Option 2*

   - *Use Case: *You want to dynamically figure out the *clientCustomerId* 
without 
   specifying it in web.config.
   - *Solution: *The Customer Service 
   
<https://developers.google.com/adwords/api/docs/reference/v201502/CustomerService>
 is 
   the ONLY service that can be called without specifying the 
   *clientCustomerId* in the web.config file. Once you retrieve the *customerId 
   *from the service, you will have to set *clientCustomerId *in your 
   program in order to use any of the other services. Please refer to the  wiki 
   post 
   
<https://github.com/googleads/googleads-dotnet-lib/wiki/Getting-Started#user-content-configuring-the-ads-user-instance-at-runtime>
 on 
   configuring the ads user instance at runtime for setting the 
*clientCustomerId 
   *after retrieving it from the CustomerService.

Wishing you the best,
Nadine, AdWords API Team

On Wednesday, April 1, 2015 at 2:04:56 PM UTC-4, Marcin Gdak wrote:
>
> Hi Nadine,
> If I don't put a clientCustomerId in my web.config, then OAuth is 
> returning the error "CustomerID is required". 
>
> I am using the help given on the side
> https://github.com/googleads/googleads-dotnet-lib/wiki/Using-OAuth2
>
> In section "Scope" I have link to Adwords. In settings the user account, 
> there is an access of the application to the campaign Adwords.
>
> Please help! :(
>
> Thank you! 
>
> W dniu środa, 1 kwietnia 2015 18:32:01 UTC+2 użytkownik Nadine Sundquist 
> (AdWords API Team) napisał:
>>
>> Hi Marcin,
>>
>> If you don't put a clientCustomerId in your web.config, then the 
>> clientCustomerId passed back from the Customer object is the 
>> clientCustomerId related to your OAuth credentials. Based on your 
>> explanation and the error that is being returned, it sounds like you may be 
>> trying to access a clientCustomerId that your OAuth user does not have 
>> permissions to access.
>>
>> Best,
>> Nadine, AdWords API Team
>>
>> On Wednesday, April 1, 2015 at 4:39:24 AM UTC-4, Marcin Gdak wrote:
>>>
>>> Hmm I am getting Idas but only then when the same I have written down in 
>>> webconfig. If it is different I am getting the error 
>>> AuthorizationError.USER_PERMISSION_DENIED.
>>>
>>> My code in C#
>>>
>>> CustomerService customerservice = 
>>> (CustomerService)user.GetService(AdWordsService.v201502.CustomerService);
>>>
>>> Customer customerActual = customerservice.get();
>>>
>>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [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 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/57502c55-8b9e-4cc3-957a-1121688325f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to