I've inherited a google adwords project which is using OAuth 2.0 for Installed Applications to connect to the google adwords API.
I'm falling over on the first hurdle; I've downloaded the following example project from github;
https://github.com/googleads/googleads-dotnet-lib/tree/master/examples/AdWords/CSharp/OAuth
When I place all the details into the web.config as directed it doesn't work. I've put in;
- the developer token
- the customer Id
- The refresh token.
This is all brand new to me, my understanding is that when using the refresh token the application should get a new access token and allow access to the API.
The above image shows the sample app interface, when I click on the "Get campaigns" link receive an exception message;
Google.Api.Ads.Common.Lib.AdsOAuthException was caught
HResult=-2146233088
Message=Failed to refresh access token.
{
"error" : "invalid_client"
}
Source=Google.Ads.Common
StackTrace:
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.OAuth2ProviderForApplications.RefreshAccessTokenIfExpiring()
at Google.Api.Ads.Common.Lib.OAuth2ProviderBase.GetAuthHeader()
at Google.Api.Ads.Common.Lib.OAuth2ProviderForApplications.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.v201601.CampaignService.get(Selector serviceSelector)
at Google.Api.Ads.AdWords.Examples.CSharp.OAuth.Default.OnGetCampaignsButtonClick(Object sender, EventArgs eventArgs) in c:\Adwords\examples\AdWords\CSharp\OAuth\Default.aspx.cs:line 130
InnerException:
The application was using these credentials in a previous application, seemingly without issue.
I've searched high and low for an answer to this, the exception says that the access token can't be refreshed but the ambiguous reasoning doesn't help a great deal.
Could someone offer any further insight?
Many thanks.