Skip to content

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

@wonggw

Description

@wonggw

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: runIssues related to the Cloud Run API.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions