github closes stream after token request
See original GitHub issueWhen I try to authenticate using GitHubOAuthenticator I always get Exception “Stream closed”.
It happens at step 2 of OAuth2 process - “https://github.com/login/oauth/authorize” executes normally and returns code, but when authenticator tries to fetch “https://github.com/login/oauth/access_token?client_id=…” exception is thrown. I found out that it happens in “tornado/simple_httpclient.py” when _write_body
method tries to await self.connection.read_response(self)
.
Although:
- I tried to fetch other arbitrary URLs from within GitHubOAuthenticator’
authenticate
method - it works fine. - I tried to fetch GitHub’s token manually with the help of curl - it works fine.
- I even found and tried to use YandexPassportOAuthenticator which has almost identical code - it works fine!
Does anyone have any ideas why this can happen?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
UploadAsync closes the stream · Issue #38 - GitHub
But first request failed due to expired tokens and stream get closed. As a result, repeated request failed too, due to closed stream....
Read more >Stream Breaks · Issue #72 · thisbejim/Pyrebase - GitHub
To resolve this we will have to figure out how to apply fresh auth tokens to our stream session without closing the stream...
Read more >Stream.CloseAsync method #31561 - dotnet/runtime - GitHub
This method would allow to implement close operation that can be ... clean up after the stream if the token had cancellation requested....
Read more >Exception when bi-directional stream get´s closed by client
Hello, i have tried to find a way preventing to following exception. By using an bi-directional stream i got this exception outside of...
Read more >Stuck on "Fetching closed dates for issues" #965 - GitHub
When I cancel with ctrl + c it just says interrupt, 'block in make_fiber`. not sure what's that... My github_changelog_generator version is: 1.16.2...
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
Found the solution: the ‘simple’ HTTP client in Tornado doesn’t work for the access_token request which is made to GitHub; configuring Tornado to use curl_httpclient instead (which requires installing pycurl as well) results in successful logins.
Adding these two lines to
jupyterhub_config.py
will take care of it:Will do. And thanks for finding that curl is a valid workaround! Curl is indeed recommended in production if you have quite a few users, for performance reasons as well.