amit-learning / google-api-dotnet-client

Automatically exported from code.google.com/p/google-api-dotnet-client
Apache License 2.0
0 stars 0 forks source link

GoogleWebAuthorizationBroker.AuthorizeAsync Hang when user closes browser #508

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use GoogleWebAuthorizationBroker.AuthorizeAsync to gain user credentials
2. User nether accepts nor rejects permission, but closes browser window/tab
3. Works on Calendar.VB.ConsoleApp, haven't tried others.

What is the expected output? What do you see instead?
An exception to be thrown which could be caught.
Program stays in loop w/o exit, even with await clause.

What version of the product are you using?
What is your operating system? Win7 and Win8
What is your IDE? VS2013
What is the .NET framework version? 4.0 and 4.5

Please provide any additional information below.
Others from SE with same issue:

http://stackoverflow.com/questions/24659654/google-drive-catch-events-during-aut
hentication
http://stackoverflow.com/questions/22995218/google-drive-oauth-connect-probem  
[Note, setting Await still wasn't able to wrap error]
http://stackoverflow.com/questions/23475498/oauth-lockup-google

Original issue reported on code.google.com by Michael....@gmail.com on 19 Nov 2014 at 2:43

GoogleCodeExporter commented 9 years ago
Also happens in my C# VSTO, which can cause Excel to hang and force termination 
at the process.

Original comment by Michael....@gmail.com on 19 Nov 2014 at 2:44

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 23 Nov 2014 at 3:26

GoogleCodeExporter commented 9 years ago

Original comment by pele...@google.com on 23 Dec 2014 at 1:49

GoogleCodeExporter commented 9 years ago
I got the same issue.
Tried to fix this like that : 

using (var cts = new CancellationTokenSource())
{
    cts.CancelAfter(TimeSpan.FromMinutes(1));

    return GoogleWebAuthorizationBroker.AuthorizeAsync(
                            clientSecrets,
                            new[] { GOOGLE_SITES_SCOPE },
                            "user",
                            cts.Token,
                            _fileDataStore).Result;
}

but cancellation does not always occur.

Original comment by prop...@gmail.com on 1 Apr 2015 at 8:50

GoogleCodeExporter commented 9 years ago
I tried the same thing but with a longer TimeSpan.  I haven't been able to 
figure out why the timeout won't work in some cases.  I have a higher successes 
rate in my console apps than VSTO, so I think it might have something to do 
with the starting environment.

Original comment by Michael....@gmail.com on 1 Apr 2015 at 1:39