Sai Teja,

We are you VB.net library to make this call.  

As I mention in my previous email the call work fine with I'm making it 
through a web application, it just does not work when I make the call from 
a windows service.  Please note:  Both web application and the windows 
service hit the same code to make the call.  I should not need to generate 
a new refresh token since it works from my web application.

Please advise!

KDJ

On Thursday, August 16, 2018 at 2:53:49 PM UTC-7, Teja Makani wrote:
>
> Hello,
>
> Could you please confirm whether you are using AdWords .NET client library 
> <https://github.com/googleads/google-ads-dotnet> for this call? If not 
> could you please share the code snippet that is making the call? You could 
> also cross verify that you are following the steps required to make API 
> call from here 
> <https://github.com/googleads/google-ads-dotnet#how-do-i-make-api-calls>.
>
> Also, to verify that your credentials are correct, you could try the CURL 
> request provided below and see if you are able to generate the access 
> token. If your credentials are correct, you should be able to generate an 
> access token for the below CURL request.
>
> curl https://www.googleapis.com/oauth2/v4/token \
> -d refresh_token=your-refresh_token \
> -d client_id=your-client-id \
> -d client_secret=your-client-secret \
> -d grant_type=refresh_token
>
> If your credentials are incorrect or still facing issue then you could try 
> generating a new refresh token with the help of this guide 
> <https://developers.google.com/adwords/api/docs/guides/first-api-call#get_an_oauth2_refresh_token_and_configure_your_client>
>  and 
> retry your request. 
>
> Regards,
> Sai Teja, AdWords API Team.
>
> On Thursday, August 16, 2018 at 1:33:37 PM UTC-4, rentca...@gmail.com 
> wrote:
>>
>> Hi,
>>
>> I'm getting error "Failed to refresh access token. See inner exception 
>> for details." when I try to get campaign information.  The line of code 
>> is page = campaignService.get(selector) where page = "CampaignPage".  This 
>> process works when I use it in a web application but not when I use it in a 
>> windows service.  Below is some information that I hope will be helpful in 
>> figuring out the problem.  I was not able to get the logging working in the 
>> windows service.
>>
>> CampaignService
>> {Google.Api.Ads.AdWords.v201806.CampaignService}
>>     Channel: {System.Runtime.Remoting.Proxies.__TransparentProxy}
>>     ChannelFactory: {System.ServiceModel.ChannelFactory(Of 
>> Google.Api.Ads.AdWords.v201806.ICampaignService)}
>>     ClientCredentials: {System.ServiceModel.Description.ClientCredentials}
>>     EnableDecompression: True
>>     Endpoint: Address={
>> https://adwords.google.com/api/adwords/cm/v201806/CampaignService}
>>     InnerChannel: {System.Runtime.Remoting.Proxies.__TransparentProxy}
>>     Proxy: {System.Net.WebRequest.WebProxyWrapper}
>>     RequestHeader: {<RequestHeader xmlns="
>> https://adwords.google.com/api/adwords/cm/v201806";>
>>   <clientCustomerId>Replace for security</clientCustomerId>
>>   <developerToken>Replace for security</developerToken>
>>   <userAgent />
>> </RequestHeader>}
>>     ResponseHeader: Nothing
>>     Signature: {Google.Api.Ads.AdWords.Lib.AdWordsServiceSignature}
>>     State: Created {0}
>>     Timeout: 0
>>     Url: "
>> https://adwords.google.com/api/adwords/cm/v201806/CampaignService";
>>     User: {Google.Api.Ads.AdWords.Lib.AdWordsUser}
>>     UserAgent: Nothing
>>
>> CampaignService.User.Config
>> {Google.Api.Ads.AdWords.Lib.AdWordsAppConfig}
>>     AdWordsApiServer: "https://adwords.google.com";
>>     ClientCustomerId: "Replace for security"
>>     DeveloperToken: "Replace for security"
>>     EnableGzipCompression: True
>>     GMBLoginEmail: ""
>>     GMBOAuth2RefreshToken: ""
>>     IncludeUtilitiesInUserAgent: False
>>     IncludeZeroImpressions: Nothing
>>     MaskCredentials: True
>>     MerchantCenterId: 0
>>     OAuth2AccessToken: ""
>>     OAuth2ClientId: "Replace for security"
>>     OAuth2ClientSecret: "Replace for security"
>>     OAuth2Mode: APPLICATION {0}
>>     OAuth2PrivateKey: ""
>>     OAuth2PrnEmail: ""
>>     OAuth2RedirectUri: "Replace for security"
>>     OAuth2RefreshToken: "Replace for security"
>>     OAuth2Scope: "https://www.googleapis.com/auth/adwords";
>>     OAuth2SecretsJsonPath: ""
>>     OAuth2ServerUrl: "https://accounts.google.com";
>>     OAuth2ServiceAccountEmail: Nothing
>>     Proxy: Nothing
>>     RetryCount: 0
>>     Signature: "AwApi-DotNet/23.6.0, Common-Dotnet/9.4.0, .NET 
>> CLR/4.0.30319.42000, "
>>     SkipColumnHeader: False
>>     SkipReportHeader: False
>>     SkipReportSummary: False
>>     Timeout: 600000
>>     UnixTimestamp: 1534434608
>>     UseRawEnumValues: Nothing
>>     UserAgent: "Replace for security"
>>
>> selector
>> {Google.Api.Ads.AdWords.v201806.Selector}
>>     dateRange: {Google.Api.Ads.AdWords.v201806.DateRange}
>>     fields: {Length=7}
>>     ordering: Nothing
>>     paging: {LIMIT 0, 500}
>>     predicates: Nothing
>> ?selector.fields
>> {Length=7}
>>     (0): "Id"
>>     (1): "Name"
>>     (2): "Status"
>>     (3): "StartDate"
>>     (4): "EndDate"
>>     (5): "BaseCampaignId"
>>     (6): "AdvertisingChannelType"
>>
>> {"Failed to refresh access token. See inner exception for details."}
>> at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean 
>> includeTaskCanceledExceptions)
>> at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, 
>> CancellationToken cancellationToken) 
>> at 
>> Google.Api.Ads.Common.OAuth.AdsOAuthProviderImpl.GetAccessTokenForAuthorizationCodeFlow()
>>   
>> at 
>> Google.Api.Ads.Common.OAuth.AdsOAuthProviderImpl.RefreshAccessTokenInOfflineMode()
>>
>> Error Occurred Message: Failed to retrieve campaign(s). Stack Trace:    
>> at YSI.Ads.GoogleAdwordsHelper.GetListOfCampaigns(String during, DateTime 
>> startDate, DateTime endDate) in 
>> C:\TFS\Cafés\yCPC\Source\GoogleAdwords.vb:line 1711   at 
>> YSI.Cafe.RC.SiteManager.AdWordsAutomatedTasks.ImportAdwordsCampaigns() in 
>> C:\TFS\Cafés\RentCafe\Source\ManagerCafe\AppClasses\AdWordsAutomatedTasks.vb:line
>>  
>> 337   at RCDaily.AdwordsImportCampaignRoutine.ImportAdwordsCampaigns() in 
>> C:\TFS\Cafés\RentCafe\Source\RCDaily\AdwordsImportCampaignsTasks.vb:line 
>> 33   at RCDaily.AdwordsImportCampaignRoutine.OnExecute(IJobExecutionContext 
>> context) in 
>> C:\TFS\Cafés\RentCafe\Source\RCDaily\AdwordsImportCampaignsTasks.vb:line 
>> 27   at RCDaily.yJob.Execute(IJobExecutionContext context) in 
>> C:\TFS\Cafés\RentCafe\Source\RCDaily\yJob.vb:line 10 Source: YSI.Ads Inner 
>> Message 1: One or more errors occurred. Inner Stack Trace 1:    at 
>> System.Threading.Tasks.Task.ThrowIfExceptional(Boolean 
>> includeTaskCanceledExceptions)   at System.Threading.Tasks.Task.Wait(Int32 
>> millisecondsTimeout, CancellationToken cancellationToken)   at 
>> Google.Api.Ads.Common.OAuth.AdsOAuthProviderImpl.GetAccessTokenForAuthorizationCodeFlow()
>>   
>>  at 
>> Google.Api.Ads.Common.OAuth.AdsOAuthProviderImpl.RefreshAccessTokenInOfflineMode()
>>  
>> Source 1: mscorlib Inner Message 2: An error occurred while sending the 
>> request. Inner Stack Trace 2:    at 
>> Google.Apis.Http.ConfigurableMessageHandler.<SendAsync>d__59.MoveNext()--- 
>> End of stack trace from previous location where exception was thrown ---  
>>  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()   at 
>> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
>>  
>> task)   at 
>> Google.Apis.Auth.OAuth2.Requests.TokenRequestExtenstions.<ExecuteAsync>d__0.MoveNext()---
>>  
>> End of stack trace from previous location where exception was thrown ---  
>>  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()   at 
>> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
>>  
>> task)   at 
>> Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.<FetchTokenAsync>d__35.MoveNext()---
>>  
>> End of stack trace from previous location where exception was thrown ---  
>>  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()   at 
>> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
>>  
>> task)   at 
>> Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.<RefreshTokenAsync>d__31.MoveNext()---
>>  
>> End of stack trace from previous location where exception was thrown ---  
>>  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()   at 
>> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
>>  
>> task)   at 
>> Google.Apis.Auth.OAuth2.UserCredential.<RefreshTokenAsync>d__16.MoveNext()---
>>  
>> End of stack trace from previous location where exception was thrown ---  
>>  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()   at 
>> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
>>  
>> task)   at 
>> Google.Apis.Auth.OAuth2.TokenRefreshManager.<RefreshTokenAsync>d__12.MoveNext()---
>>  
>> End of stack trace from previous location where exception was thrown ---  
>>  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()   at 
>> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
>>  
>> task)   at 
>> Google.Apis.Auth.OAuth2.TokenRefreshManager.<GetAccessTokenForRequestAsync>d__10.MoveNext()
>>  
>> Source 2: Google.Apis.Core Inner Message 3: Unable to connect to the remote 
>> server Inner Stack Trace 3:    at 
>> System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, 
>> TransportContext& context)   at 
>> System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar) 
>> Source 3: System Inner Message 4: No connection could be made because the 
>> target machine actively refused it 127.0.0.1:8888 Inner Stack Trace 4:  
>>   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)   at 
>> System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, 
>> Socket s4, Socket s6, Socket& socket, IPAddress& address, 
>> ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) 
>> Source 4: System 
>>
>> KDJ
>>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 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 and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@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/f1a1183b-f22f-4758-a58f-37f5f651cd40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • ... rentcafedev1
    • ... 'Teja Makani' via AdWords API and Google Ads API Forum
      • ... rentcafedev1
    • ... 'Teja Makani' via AdWords API and Google Ads API Forum
      • ... rentcafedev1
        • ... 'Nadine Sundquist (AdWords API Team)' via AdWords API and Google Ads API Forum
    • ... 'Nadine Sundquist (AdWords API Team)' via AdWords API and Google Ads API Forum

Reply via email to