I get this error after having authenticated from within a .Net desktop 
application:

Google.Ads.GoogleAds.V9.Errors.GoogleAdsException
  HResult=0x80131500
  Message=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.";

What is the correct code to use to authenticate please?

This is what I currently use:

GoogleAdsConfig config = new GoogleAdsConfig()
            {
                DeveloperToken = "******",
                OAuth2Mode = OAuth2Flow.APPLICATION,
                OAuth2ClientId = 
"77834483876-1kgp7ggidhacug709g3cb3.apps.googleusercontent.com",
                OAuth2ClientSecret = "GOCSPX-PNxVv90i-niUB1YBJs1FUOCL",
                OAuth2RefreshToken = "******"
            };
            
        //GoogleAdsConfig config = new GoogleAdsConfig();
        // Load the JSON secrets.
        ClientSecrets secrets = new ClientSecrets()
            {
                ClientId = config.OAuth2ClientId,
                ClientSecret = config.OAuth2ClientSecret
            };

            // Authorize the user using desktop application flow.
            Task<UserCredential> task = 
GoogleWebAuthorizationBroker.AuthorizeAsync(
                secrets,
                new string[] { GOOGLE_ADS_API_SCOPE },
                String.Empty,
                CancellationToken.None,
                new NullDataStore()
            );
            UserCredential credential = task.Result;

            // Store this token for future use.
            string refreshToken = credential.Token.RefreshToken;

            // To make a call, set the refreshtoken to the config, and
            // create the GoogleAdsClient.
            config.OAuth2RefreshToken = refreshToken;
            GoogleAdsClient client = new GoogleAdsClient(config);

            // Create the required service.
            GoogleAdsServiceClient googleAdsService = client.GetService(
              Services.V9.GoogleAdsService);


 

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [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 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/481bb481-9d3f-4512-b5de-ec035d4f6d2dn%40googlegroups.com.
  • Au... Werner Reyneke
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
      • ... Werner Reyneke
      • ... Werner Reyneke
        • ... Werner Reyneke
        • ... Werner Reyneke

Reply via email to