question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Drive with ServiceAccount hangs on first API call

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:19

github_iconTop GitHub Comments

2reactions
zoharyosefcommented, Jan 10, 2017

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();

0reactions
jamesgbccommented, Oct 16, 2015

Hi Jan

Yes when I import those two classes into my local code with the additions of ConfigureAwait(false), then everything works.

cheers

James

On 15 October 2015 at 23:11, Jan Tattermusch notifications@github.com wrote:

@jamesgbc https://github.com/jamesgbc can you please take a look if pull request #612 https://github.com/google/google-api-dotnet-client/pull/612 would fix the issue?

— Reply to this email directly or view it on GitHub https://github.com/google/google-api-dotnet-client/issues/590#issuecomment-148537806 .

James Ellis-Jones Head of Technology

News: Great Italian Chefs - coming soon http://www.greatitalianchefs.com/

www.greatbritishchefs.com

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google Drive API, Oauth and service account
I've some issues with Google Drive API, service account and authentication. I read a lot, but I cannot figure out how to solve...
Read more >
Service account validation | Apigee
Enable service account permission validation · Open the Google Cloud console and log in with the account you created in Step 1: Create...
Read more >
Troubleshoot Config Connector
One way to do this is to temporarily stop syncing configs, wait for Config Connector to finish reconciling the resource, and then update...
Read more >
Getting started with Fleet Engine | Fleet Performance
You create a DeliveryVehicle object using: The Project ID of the Google Cloud project that contains the service account used to call the...
Read more >
Download and export monthly reports - Play Console Help
Download reports. Open Play Console. Click Download reports Reports , and select Reviews, Statistics, or Financial. Under "Select an application," type and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found