First I received a "CUSTOMER_NOT_ACTIVE" error. I created new credentials and generated a refresh token in
console.developers.google.com, and the error changed to "Failed to refresh access token". I receive this error in
the official tests project I downloaded, so I guess that it's something in the credentials and not in the code.
Could you please help? Why does the token suppose to be refreshed if I just created it?
AdWordsUser user = GoogleHelper.GetUserForTargetingIdeaService(accountId);
using (var srv = user.GetService(AdWordsService.v201809.TargetingIdeaService) as TargetingIdeaService)
{
var pl = new List<SearchParameter>
{
// ...
};
var selector = new TargetingIdeaSelector
{
requestType = RequestType.STATS,
ideaType = IdeaType.KEYWORD,
paging = Paging.Default,
searchParameters = pl.ToArray(),
requestedAttributeTypes = new AttributeType[]
{
AttributeType.SEARCH_VOLUME, AttributeType.KEYWORD_TEXT,
AttributeType.AVERAGE_CPC, AttributeType.TARGETED_MONTHLY_SEARCHES, AttributeType.COMPETITION
}
};
TargetingIdeaPage page = await srv.getAsync(selector);
// ...
}
Google.Api.Ads.Common.Lib.AdsOAuthException: Failed to refresh access token. ---> System.AggregateException: One or more errors occurred. ---> Google.Apis.Auth.OAuth2.Responses.TokenResponseException: Error:"invalid_grant", Description:"Bad Request", Uri:"" at Google.Apis.Auth.OAuth2.Requests.TokenRequestExtenstions.<ExecuteAsync>d__0.MoveNext()
...