HttpStatusCode not set in exceptions when using Google .Net APIs -
i'm having issues when using google apis .net. when calling service , call fails reason googleapiexception thrown. httpstatuscode 0 in exception. can parse status code message of course not nice solution.
i'm using latest binaries nuget (1.5.0.28972)
i'm having problem getting exponentialbackoff algorithm work , think related issue.
below som code duplicate behaviour.
const string serviceaccount = "000000000000@developer.gserviceaccount.com"; const string keyfile = @"c:\privatekey.p12"; const string keypass = "notasecret"; const string applicationname = "test"; const string user = "admin@some-domain.com"; // user wish act static void main(string[] args) { var certificate = new x509certificate2(keyfile, keypass, x509keystorageflags.exportable); var provider = new assertionflowclient(googleauthenticationserver.description, certificate) { serviceaccountid = serviceaccount, scope = directoryservice.scopes.admindirectoryuser.getstringvalue(), serviceaccountuser = user, }; var authenticator = new oauth2authenticator<assertionflowclient>(provider, assertionflowclient.getstate); var initializer = new baseclientservice.initializer { authenticator = authenticator, defaultexponentialbackoffpolicy = baseclientservice.exponentialbackoffpolicy.unsuccessfulresponse503 }; var service = new directoryservice(initializer); // throw googleapiexception the httpstatuscode 0 (should 409) var user = service.users.get("none-existing-user@some-domain.com").execute(); }
regards /tor
Comments
Post a Comment