C#  .Net Framework 4.8

I was told to use a service account otherwise I would be using 
OAuth2/ClientSecret/Id/etc

I'm using the *same *Service Account to successfully extract data 
from AnalyticsDataService



Right now my code is very simple just trying to get it to authenticate and 
return some data.

            var googleAdsConfig = new GoogleAdsConfig
            {
                DeveloperToken = "vcvcxvvxvxxcvxvxxc",
                OAuth2Mode = OAuth2Flow.SERVICE_ACCOUNT,
                OAuth2SecretsJsonPath = credentialsFilePath,
                OAuth2Scope = "https://www.googleapis.com/auth/adwords";,
                OAuth2PrnEmail = "star*********serviceaccount.com"
            };

            var googleAdsClient = new GoogleAdsClient(googleAdsConfig);

            // Get the Google Ads service
            var googleAdsService =  
 googleAdsClient.GetService(Services.V17.GoogleAdsService);

            // Replace with your desired query
            var query = @"
                SELECT
                    campaign.name,
                    ad_group.status
                FROM campaign
                WHERE campaign.status IN (ENABLED, PAUSED)
            ";

            // Execute the search request
            var searchStreamResponse = 
 googleAdsService.SearchStream("NNNNNN", query,
                    delegate (SearchGoogleAdsStreamResponse resp)
                    {
                        foreach (GoogleAdsRow googleAdsRow in resp.Results)
                        {
                            Console.WriteLine("Campaign with ID {0} and 
name '{1}' was found.",
                                googleAdsRow.Campaign.Id, 
googleAdsRow.Campaign.Name);
                        }
                    }
                );

I get the error 

Status(StatusCode="Unauthenticated", Detail="Request is missing required 
authentication credential. Expected OAuth 2 access token, login cookie or 
other valid authentication credential. See 
https://developers.google.com/identity/sign-in/web/devconsole-project.";

thanks for your help,

lee

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@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 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/17ccf10a-69e9-4ae9-9939-afc660951771n%40googlegroups.com.

Reply via email to