-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installed application: Page not found after successful grant through LocalServerCodeReceiver #540
Comments
Closing as stale, please reopen if still an issue. |
Re-opening, looks like this is still as issue: http://stackoverflow.com/questions/43357777/gmail-api-net-googlewebauthorizationbroker-authorizeasync-leaves-browser-waitin |
Closing, as I cannot reproduce this. |
I can still reproduce this. The source code I'm using is shown here: I just tested it again now, and it does provide the code okay, but the browser stays spinning, with the URL: http://localhost:50331/authorize/?code=4/<redacted_code> I tested it using Chrome as my default browser (Version 59.0.3071.115 (Official Build) (64-bit)). You can also test it with our product that is using this code. It is Remind-Me. If you install the trial and create a new event, and go to the "Email" tab, and press "Configure..." you can choose to use OAuth2.0 and then press "Get Authorization..." to reproduce the issue. I don't know how to "re-open" this issue? Apparently, just replying doesn't automatically re-open it, and I don't see any link to re-open? |
Reopening. What kind of application are you running (console? WinForms? WPF?)? If you could reproduce this in a minimal sample app, that would really help. Do you see any exceptions at all? I'd expect it to spin if it hasn't managed to create the local server properly, for example. |
@chrisdunelm @jskeet also reproducible for me. I temporarily added small workaround with using custom LocalServerCodeReceiver.cs and calling
I can even reproduce it with this Google OAuthDesktopApp sample: |
@rolshevsky: It's not clear why you'd want to call |
@jskeet : I can't reproduce it using that Google OAuthDesktopApp sample. The sample works for me. My app is a C++ native windows application. I will try to create a minimal sample app to reproduce it using the same code that is causing the problem. I will post it back here when done. |
@rolshevsky I cannot reproduce this with the OAuthDesktopApp sample. I suspect the problem is dependent on the machine it's running on. @mbeiley If your app is a C++ native windows application, why are you using the .NET client library? I suspect the problem is that the server socket is being shutdown before all/any bytes have been sent to the client. Hence a fixed delay can resolve the problem, so possibly a delay in |
@chrisdunelm : I am using the .NET client library to handle the OAuth communication because there is no C++ library that I'm aware of. I built a small EXE using the .NET and this client library. From within my C++ application I start another thread that calls CreateProcess() and runs the EXE. The main application monitors this process, and waits for it to return. I'm guessing this is somehow causing the problem? |
@chrisdunelm @jskeet I have created simple project for reproducing this issue with latest Here is the video with usefull showcase how we can reproduce it: video. This issue reproducible not only on my home PC, also I can reproduce it on my work machine with |
@rolshevsky Thank you for the repro. I'm now also seeing the problem.
So I hope we'll be able to understand what's going on fairly soon. |
@chrisdunelm : I have attached a complete/minimal sample that reproduces the problem I'm seeing. You need to have a project with the Gmail API enabled, and put that info in Gmail.cs on lines 47 and 48. If you run this you will see it successfully gets the required authorization, but the browser just hangs. |
@mbeiley Thank you also. |
Fixes googleapis#540. Really fixes googleapis#1055
Fixes googleapis#540. Really fixes googleapis#1055
There is frequent error when authenticating user through GoogleWebAuthorizationBroker.AuthorizeAsync method. The authentication page is correctly displayed but after confirming application access the browser hangs on "Page Not Found" (localserver:portnumber). But, both tokens are successfully transmitted back to the application. This problem is more frequent when authenticating through proxy.
Hotfix: I did some research and replaced the code with my own copy of LocalServerCodeReceiver. The problem is that HttpListener closes before the response is delivered. I've made quick hotfix by placing Thread.Sleep(10) on the line 99 in the original file (after closing the response stream and before returning instance of AuthorizationCodeResponseUrl). There is probably more elegant way how to fix this but I have no more time to search for correct fix.
The text was updated successfully, but these errors were encountered: