"unauthorized_client" is returning zero search results in this forum; 
that's hard to believe, maybe it's a temporary problem with the search 
engine.  My apologies if there's already a thread for it.

I'm using the .Net library, and calling get() on 
Google.Api.Ads.AdWords.v201306.CampaignService.  This is failing; here's 
the error:

Google.Api.Ads.Common.Lib.AdsOAuthException: Failed to refresh access token.
{
"error" : "unauthorized_client"
}

...and the stack trace:

at 
Google.Api.Ads.Common.Lib.OAuth2ProviderForApplications.RefreshAccessTokenInOfflineMode()
at 
Google.Api.Ads.Common.Lib.OAuth2ProviderForApplications.RefreshAccessToken()
at 
Google.Api.Ads.Common.Lib.OAuth2ProviderBase.RefreshAccessTokenIfExpiring()
at Google.Api.Ads.Common.Lib.OAuth2ProviderBase.GetAuthHeader()
at Google.Api.Ads.AdWords.Lib.AdWordsSoapClient.InitForCall(String 
methodName, Object[] parameters)
at Google.Api.Ads.Common.Lib.AdsSoapClient.MakeApiCall(String methodName, 
Object[] parameters)
at Google.Api.Ads.Common.Lib.AdsSoapClient.Invoke(String methodName, 
Object[] parameters)
at Google.Api.Ads.AdWords.v201306.CampaignService.get(Selector 
serviceSelector)
<my code...>

I can only assume that I'm not giving the library enough data; here's where 
I initialize my user info:

_oAuth2User = new AdWordsUser();

AdWordsAppConfig  apiConfig = (AdWordsAppConfig)_oAuth2User.Config;
apiConfig.AuthorizationMethod = AdWordsAuthorizationMethod.OAuth2;
apiConfig.DeveloperToken      = _developerToken;

OAuth2ProviderForApplications  oAuthProvider = new 
OAuth2ProviderForApplications(apiConfig);
oAuthProvider.Config.OAuth2Mode = OAuth2Flow.APPLICATION;
oAuthProvider.ClientId          = _clientId;
oAuthProvider.ClientSecret      = _clientSecret;
oAuthProvider.RefreshToken      = _refreshToken;

_oAuth2User.OAuthProvider = oAuthProvider;

I've collected my client ID, client secret, developer token, auth token, 
and refresh token (with the AdWords scope) from Google.  A client ID, 
client secret, and refresh token are enough to generate new access tokens 
at will (I've done it, for other Google APIs), so I'm not sure what's 
causing the error.

If there is another field I need to specify, the library should flag that 
specifically rather than giving a generic error message.  Making an OAuth 
subclass of AdWordsUser with parameters for the required fields, rather 
than making us guess about what's needed and populate several different 
objects, would really help move this library into "ready for prime time."

I can connect to AdWords just fine for ad hoc reports when I bypass the 
.Net library and simply POST to 
https://adwords.google.com/api/adwords/reportdownload/v201306.  I haven't 
seen a similar mechanism for campaigns and ad groups, but that would be my 
preference if anyone can point me in the right direction.

- J

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

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+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 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to