Hello,
I's using Adwords API Guide to call API examples in .NET Library, but get an exception:
Customer passed in an invalid token in the header.. (Error: QuotaCheckError.INVALID_TOKEN_HEADER, FieldPath: , Trigger: "MY_DEVELOPER TOKEN(combination of symbols")Google.Api.Ads.AdWords.Lib.AdWordsApiException (AdWordsApiException: One or more AdWords API errors have occurred.
Steps I did:
1. Created manager production account, got Developer Token.
2. Created Test Manager account. While logged in test manager account, created client account using "Account -> new Adwords Account", got CLIENT_ID (10 numbers). Added test campaigns to client account.
3. While logged in test manager account, created Credentials ( client_id, client_secret) in Google API Console Credentials page.
4. Used these credentials to generate Auth2RefreshToken in Auth2TokenGenerator.exe. I was logged in to test manager account when clicked " Manage your AdWords campaigns -> Allow". Got Auth2RefreshToken .
This is a part of my app.config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="AdWordsApi" type="System.Configuration.DictionarySectionHandler" />
</configSections>
<AdWordsApi>
<!-- Settings related to SOAP logging. -->
<add key="MaskCredentials" value="true"/>
<add key="EnableSoapExtension" value="true"/>
<!-- Settings related to general library behaviour. -->
<!-- Use this key to automatically retry a call that failed due to a
recoverable error like expired credentials. -->
<!-- <add key="RetryCount" value="1" /> -->
<!-- Set the service timeout in milliseconds. -->
<!-- <add key="Timeout" value="100000" /> -->
<!-- Use this key to enable or disable gzip compression in SOAP requests.-->
<add key="EnableGzipCompression" value="true" />
<!-- Set this flag to true to include the list of client library utilities
that your code uses in the user agent string.-->
<add key="IncludeUtilitiesInUserAgent" value="true" />
<!-- Proxy settings for library. -->
<add key="ProxyServer" value="" />
<add key="ProxyUser" value="" />
<add key="ProxyPassword" value="" />
<add key="ProxyDomain" value="" />
<!-- Settings specific to AdWords API.-->
<add key="UserAgent" value="MY_COMPANY_NAME" />
<!-- See https://developers.google.com/adwords/api/docs/signingup for
instructions on signing up for a developer token.-->
<add key="DeveloperToken" value="MY_DEVELOPER_TOKEN_FROM STEP 1" />
<add key="ClientCustomerId" value="CLIENT CUSTOMER ID FROM STEP 2" />
<!-- Use the following settings to skip the report header and summary rows
when downloading a report in CSV, TSV or their gzipped formats. -->
<add key="SkipReportHeader" value="false" />
<add key="SkipReportSummary" value="false" />
<add key="SkipColumnHeader" value="false" />
<!-- <add key="IncludeZeroImpressions" value="true" /> -->
<!-- <add key="UseRawEnumValues" value="true" /> -->
<!-- Settings specific to use OAuth2 as authentication mechanism. You could
run Common\Util\OAuth2TokenGenerator.cs to generate this section of the
config file.
-->
<add key='OAuth2ClientId' value="OAuth2 CLIENT ID FROM STEP 3' />
<add key='OAuth2ClientSecret' value='"OAuth2CLIENT SECRET FROM STEP 3' />
<add key="OAuth2Mode" value="APPLICATION" />
<add key='OAuth2RefreshToken' value='REFRESH TOKEN FROM STEP 4' />
<!-- Optional: Specify an OAuth2 redirect url if you are building a
web application and implementing OAuth2 web flow in your application.
-->
<!-- <add key="OAuth2RedirectUri" value="" /> -->
<!--
<add key="OAuth2Mode" value="SERVICE_ACCOUNT" />
<add key="OAuth2PrnEmail" value="INSERT_OAUTH2_USER_EMAIL_HERE" />
<add key="OAuth2SecretsJsonPath" value="INSERT_OAUTH2_SECRETS_JSON_FILE_PATH_HERE" />
-->
<!-- The following keys are deprecated, use OAuth2SecretsJsonPath instead.-->
<!--
<add key="OAuth2ServiceAccountEmail"
value="INSERT_OAUTH2_SERVICE_ACCOUNT_EMAIL_HERE" />
<add key="OAuth2JwtCertificatePath"
value="INSERT_OAUTH2_JWT_CERTIFICATE_PATH_HERE" />
<add key="OAuth2JwtCertificatePassword"
value="INSERT_OAUTH2_JWT_CERTIFICATE_PASSWORD_HERE" />
-->
</AdWordsApi>
</configuration>
Please, tell me what I'm doing wrong. Also I have a question. Should I connect somehow manager production account and manager test account?
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@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.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/324a03c0-742c-472f-80e6-32a4ffe90f7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment