Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
bq_auth() fails in GCP AI Platform Notebooks #340
(apologies if this is the incorrect place to file this bug)
When authenticating using bg_auth() / gargle::token_fetch(), the google redirect url expects to redirect the browser to a new port on localhost. However, when using a managed service such as GCP AI Platform Notebooks the localhost redirect means you end up at the wrong location.
Expected behavior: bq_auth() should have an option to authenticate with Google using just the command line.
I suspect there's a bug in gargle's authentication code that prevents it from detecting when it should use the offline auth method. For example, if you run 'gcloud auth login' on your local dev box, the authentication url generated will have redirect_uri set to a port on localhost. But the same command on GCP AI Platform Notebooks will instead set redirect_uri to
I suspect that this is the login flow you want to follow: https://developers.google.com/identity/protocols/OAuth2ForDevices
Though it's possible that I simply haven't understood how the library is supposed to be used in this scenario.
Thanks for all your hard work!
If I use
If I instead open up R in a terminal (still within JupyterLab) and run that command I get:
Note that it's asking me to choose between Yes and No but the question that I'm responding yes/no to is not displayed.
I selected "yes" and got the following error:
Copy/pasting that link into a web browser did take me through the appropriate auth workflow and gave me a code to copy/paste into the bigrquery auth process. I pasted it below the error message even though the console hadn't appeared to be asking for an input. Pasting that code and hitting "enter" caused the following error message to appear:
Interestingly, some level of auth seems to have succeeded with those previous steps since now when I try to run
However, if I got back to the jupyter notebook and try to
The Yes/No menu that is printing without its header and the warnings that are leaking through
So, please "power cycle" via:
And let's resume the troubleshooting for this platform. To be clear, I don't think the above will fix your problems, but it gets us to a saner and less noisy workflow.
Sure, here are the results.
TLDR: I still can't use the
Setting up the environment (in a new GCP AI Platform Notebook using R 3.x):
Trying use_oob in the Jupyter Lab console results in the following outputs. It seems to be somewhat working despite the unnecessary warning.
Three usability issues with this step:
At this point I am able to access BigQuery using the JupyterLab command line. If I restart the notebook kernel I can now run queries against bigquery if I use the email based auth to pull the cached credentials (the
Fyi, I've posted a blog post describing the workaround. Thinking about it, this issue actually affects any instance of a Jupyter Notebook that's being executed on a remote machine