-
Notifications
You must be signed in to change notification settings - Fork 183
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
bq_auth() fails in GCP AI Platform Notebooks #340
Comments
What happens if you use out-of-bound auth? For example, what if you do |
@craigcitro In the context @ZainRizvi describes, which credential fetching function should be succeeding and taking care of this? Should we really be falling all the way through to OAuth2? |
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 🙈 have both already been fixed upstream in gargle. So you will need to install dev gargle. I'll do another gargle CRAN release soon that includes those fixes. I'm just working through my release prep for another package (googledrive) first, in case I need to include any other tweaks. 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 Detailed results: Setting up the environment (in a new GCP AI Platform Notebook using R 3.x):
Running
Running
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
|
Thanks for the update. We will try to make this smoother. cc @craigcitro Would love to hear any observations. These are flows / contexts I have no personal experience with but that I think you were targeting with your initial work on gargle. |
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 http://zainrizvi.io/blog/authenticating-to-bigrquery-on-gcp-ai-platform-notebooks/ |
BTW the stuff I describe above as being only fixed in dev gargle are now fixed in the CRAN version. So, I'm sure this flow is not yet fixed, but the ancillary annoyances should be gone. |
Gentle ping again @craigcitro. I'd love your opinion on which flow should kick in here. |
Now tracking in r-lib/gargle#138. |
(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
urn:ietf:wg:oauth:2.0:oob
. The auth url for the latter option will result in you getting a string to copy/paste into your command line to complete the authentication process without having to access a second port.Repro steps:
Try to authenticate yourself:
bq_auth(email="[email protected]")
The authentication hangs forever. Even if you copy/paste the resulting url, the redirect will fail since the 'localhost' is on a VM running in GCP, not your local box
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!
The text was updated successfully, but these errors were encountered: