Skip to content

run_local_server() method is block when access block at google sign in #239

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

Closed
wonggw opened this issue Oct 14, 2022 · 3 comments · Fixed by #245
Closed

run_local_server() method is block when access block at google sign in #239

wonggw opened this issue Oct 14, 2022 · 3 comments · Fixed by #245
Labels
api: run Issues related to the Cloud Run API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@wonggw
Copy link
Contributor

wonggw commented Oct 14, 2022

Environment details

  • OS type and version: macOS 12
  • Python version: Python 3.10.7
  • pip version: pip 22.2.2
  • google-auth-oauthlib version: 0.5.3

Steps to reproduce

  1. Run these methods
  flow = InstalledAppFlow.from_client_secrets_file(client_secrets_file,
                                            scopes=[
                                                'openid', 'https://www.googleapis.com/auth/userinfo.email',
                                                'https://www.googleapis.com/auth/userinfo.profile'
                                            ])

google_credentials = flow.run_local_server(
    host='localhost',
    port=8080,
    authorization_prompt_message='Please visit this URL: {url}',
    success_message='The auth flow is complete; you may close this window.',
    open_browser=True)
  1. Access it with an unauthorized account

Code example to resolve

Add this additional code in run_local_server() method

    _DEFAULT_TIMEOUT = 5

    def run_local_server(
        self,
        host="localhost",
        bind_addr=None,
        port=8080,
        authorization_prompt_message=_DEFAULT_AUTH_PROMPT_MESSAGE,
        success_message=_DEFAULT_WEB_SUCCESS_MESSAGE,
        open_browser=True,
        redirect_uri_trailing_slash=True,
        timeout = _DEFAULT_TIMEOUT,
        **kwargs
    ):
        local_server.timeout = timeout

I will raise a PR if this is agreed upon.

@product-auto-label product-auto-label bot added the api: run Issues related to the Cloud Run API. label Oct 14, 2022
@clundin25
Copy link
Contributor

@sai-sunder-s please take a look.

My 2cents, I am okay with adding a timeout but we use an Optional parameter that will default to None. This allows callers to introduce a timeout without modifying the existing behavior.

Also please change the timeout variable name to include the units. E.g. timeout_seconds or a variation of it.

@clundin25 clundin25 added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Oct 18, 2022
@sai-sunder-s
Copy link
Contributor

@sai-sunder-s please take a look.

My 2cents, I am okay with adding a timeout but we use an Optional parameter that will default to None. This allows callers to introduce a timeout without modifying the existing behavior.

Also please change the timeout variable name to include the units. E.g. timeout_seconds or a variation of it.

Looks like default value for timeout field is None anyway and it is handled properly.

@wonggw
Copy link
Contributor Author

wonggw commented Oct 19, 2022

@clundin25, thanks for your suggestion. I made a pull request with those changes.
#245

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: run Issues related to the Cloud Run API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
3 participants