I use the Google APIs Client Library for .NET to load Google Analytics data into my application:
Recently, although I found that it began to completely freeze. The Execute() command establishes a connection to a Google server.
He makes a successful request:
https://accounts.google.com/o/oauth2/token
which returns something like:
{ "access_token" : "ya30.HAKlQSGZo2GnK5wxlxx9TLTQUyD9Xkt7AZxuQnDY-KhJuCyrCtN_xHIP", "token_type" : "Bearer", "expires_in" : 3600 }
But it never returns from an Execute call.
The same code in the console application is immediately returned, but in IIS it is not currently returned.
In the previous version, it worked just fine (I'm not quite sure which version has changed).
My Load User Profile set to true.
What could be the reason for this?
var SERVICE_ACCOUNT_PKCS12_FILE_PATH = @"C:\TEMP\GoogleAnalytics-privatekey.p12"; X509Certificate2 certificate = new X509Certificate2(SERVICE_ACCOUNT_PKCS12_FILE_PATH, "notasecret", X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable); // Create credentials (not my real login here) ServiceAccountCredential credential = new ServiceAccountCredential( new ServiceAccountCredential.Initializer(" 86987278011-ctegcus4og7kn6oigkrv8po5pf67bbgj@developer.gservicea ccount.com") { Scopes = new[] { AnalyticsService.Scope.AnalyticsReadonly } }.FromCertificate(certificate)); // Create the service var service = new AnalyticsService(new BaseClientService.Initializer() { HttpClientInitializer = credential, ApplicationName = "Google Analytics Application", }); // get accounts accounts = service.Management.Accounts.List(); var items = accounts.Execute();
asp.net-mvc oauth google-api google-analytics-api google-api-dotnet-client
Simon_Weaver
source share