Skip to content
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

Running run_local_server in Colab notebook doesn't redirect properly #277

Open
chrissyast opened this issue Apr 19, 2023 · 3 comments
Open
Labels
type: question Request for information or clarification. Not an issue.

Comments

@chrissyast
Copy link

    if not creds or not creds.valid:
        if creds and creds.expired and creds.refresh_token:
            creds.refresh(Request())
        else:
            flow = InstalledAppFlow.from_client_secrets_file(
                'credentials.json', SCOPES)
            creds = flow.run_local_server(port=0)

Trying to run this in a Colab file prints a URL that I need to go to authorise the app. On doing so I'm redirected to http://localhost:58787/?state=blah which can't be reached and the notebook remains listening for a response.

@sai-sunder-s
Copy link
Contributor

Can you trying removing the port=0 param?
Usually a port is auto assigned I believe.

@sai-sunder-s sai-sunder-s added the type: question Request for information or clarification. Not an issue. label Jul 18, 2023
@chrissyast
Copy link
Author

@sai-sunder-s After removing the port param, I get an error OSError: [Errno 98] Address already in use

@sai-sunder-s
Copy link
Contributor

I think I understood the problem. Since you are using colab, you are using a browser I am assuming? So colab doesn't have the ability to listen to localhost. That is why it just listens for a response indefinitely I guess.

I have heard of people using pydata-google-auth for notebook scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

2 participants