google-api-dotnet-client: Drive with ServiceAccount hangs on first API call
Hello,
I upgraded Google Drive (and all dependencies) NuGet package to the latest version 1.9.3 and from that time the Drive is not working for me. Versions from 1.6 to 1.9.2 were working fine. I’m using it in ASP.NET MVC 5 project and I’m using synchronous calls.
I’m using ServiceAccount, here it the initialiation of the driveService:
var initializer = new ServiceAccountCredential(new ServiceAccountCredential.Initializer(configuration.DriveApiClientId)
{
User = account.GetEmailAddress(),
Scopes = new[] { DriveService.Scope.Drive },
}.FromCertificate(key));
driveService = new DriveService(new BaseClientService.Initializer
{
HttpClientInitializer = initializer,
ApplicationName = "TC6",
});
When I execute first Drive API command (I tried driveService.About.Get().Execute()) I can see in the Fiddler one completed request:
POST https://accounts.google.com/o/oauth2/token HTTP/1.1
but the result of the command is never returned, it seems that there is a deadlock but I can’t find where.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 19 (5 by maintainers)
I know it an old issue, leaving my solution for others who ran into it. I solved the issue by using wait() instead of await:
credential.RequestAccessTokenAsync(CancellationToken.None).Wait();