GoogleWebAuthorizationBroker.AuthorizeAsync Hang when user closes browser
See original GitHub issueWhat 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
Issue Analytics
- State:
- Created 8 years ago
- Comments:11
Top Results From Across the Web
GoogleWebAuthorizationBroker.AuthorizeAsync() hangs if ...
It is not possible, in general, to detect when the user has closed the browser window/tab. For example, if the user is already...
Read more >OAuth 2.0 | API Client Library for .NET
In this sample code a new UserCredential instance is created by calling the GoogleWebAuthorizationBroker.AuthorizeAsync method. This static ...
Read more >Connecting to Google using OAuth2 and C# | Daimto
Using OAuth2 with an installed application C# .net core application how to configure File datastore to store your user credentials.
Read more >OAuth 2.0 for Google Regular Accounts (installed ...
NET Core 2.0\C#\OAuthUniversalApp project on how to use OAuth to ... AuthorizeAsync call will open the browser window asking for // authorization.
Read more >Class GoogleWebAuthorizationBroker
This class is only suitable for client-side use, as it starts a local browser that requires user interaction. Do not use this class...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We can throw timeout exception using thread when the thread meets the timeout value, below is the code and it serves my purpose. Here i have set the timeout value to 2 mins (120,000 milliseconds).
using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(SystemDataUtils.ConvertToJson<GDriveConfiguration>()))) { UserCredential cred = null;
It is not possible, in general, to detect when the user has closed the browser window/tab. For example, if the user is already running their default browser, then GoogleWebAuthorizationBroker opens a new tab, this is not running in the process started in LocalServerCodeReceiver. That new process terminates immediately.
However, currently the CancellationToken passed to
GoogleWebAuthorizationBroker.AuthorizeAsync
is not honoured whilst waiting for the auth response. #968 filed to fix this.