googleapis / google-auth-library-python-oauthlib

Apache License 2.0
186 stars 82 forks source link

feat: Raise meaningful exception when oauth callback times out #363

Open mafrosis opened 4 months ago

mafrosis commented 4 months ago

I found that when timeout_seconds parameter is used, the code raises an exception such as:

  File "/usr/lib/python3.12/site-packages/google_auth_oauthlib/flow.py", line 520, in run_local_server
    authorization_response = wsgi_app.last_request_uri.replace("http", "https")
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'replace'

This PR adds a custom exception such that a caller can handle this case.

I'm unable to run the full nox suite locally, but it looks like nothing has broken. I'll make any changes needed when the CI tests run.