-
Notifications
You must be signed in to change notification settings - Fork 33
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 #138
Comments
Is this still an issue? googleAuthR/gargle are installed in the R notebooks and I have an example here: https://github.com/MarkEdmondson1234/googleAuthR/blob/master/inst/jupyter/googleAuthR.ipynb |
Interesting! I have not looked into this personally. But it would be great to learn that all is well. I’ll leave open for a bit to encourage further comment (or maybe I’ll try it myself). But I consider this semi-closed, then. |
@ZainRizvi If you can take a look at @MarkEdmondson1234's example and react here, that would be great. I'm submitting a gargle release to CRAN soon. |
It is possible that the same print debugging described in #130 (comment) would reveal useful information here as well and generate some forward momentum. |
@jennybc and @MarkEdmondson1234, based on the documentation we run: sql <- 'SELECT * FROM But it doesn't work... we have tried many versions of the key-values in the big_auth(), We don't even get the question to pass the token. it runs without any output. The access logic works with the python SDK. we don't have any problem with this access design in terms of GCP when we run python but when we follow the big_auth() documentation to do the same with R, we don't get prompted to access a url and get credentials and the big_auth(email) seems doesn't work. We tried it with RStudio as well and it didn't work. Because we have 2 types of R projects, with R notebook and with RStudio. |
I'm pretty sure bq_auth() with email won't work as it's interactive and jupyter notebooks are in non-interactive realm. But if you auth instead with the GCE auth (gargle::credentials_gce() ) it should work as it will reuse the auth that comes with the notebooks, or you can upload a json account service key and auth via that. |
@MarkEdmondson1234 this is what we dont want to do. AI notebook and Rstudio at the moment use the service acccount which is attached to the instance to interact with datasets in BQ. This pattern works with python because the python sdk has a client that calls. But we need the same for R. The user needs to call the dataset with their email not the service account of the machine. |
Have you tried use_oob=TRUE ? |
We tried big_auth with use_oob=TRUE, it didn't do anything on the RStudio running on a GCE, and the R AI notebook. However, when one of our R developers ran it from their RStudio installed on their personal laptop, it worked. |
The issue identified above by snowlover173 appears to be caused by the following:
For anyone who wants to use the interactive, browser based OAuth dance for user authentication in AI platform notebooks or web-based R Studio, I recommend the following workaround: Step 1Complete the OAuth dance using gcloud command line utility. The gcloud interactive prompt works in both Jupyter notebooks and web-based R Studio. (If gcloud is not installed, you can run
Step 2Run the commands below. Make sure you edit it first, so that the email address is the same address you chose in the browser during Step 1.
This will copy the oauth2.0 token generated by gcloud to a location where gargle expects to find it. As a result, all R libraries that use gargle will be successfully authenticated.
|
Getting similar error -
|
++ |
Windows UsersI've been struggling with bigrquery authentication for a long time. Recently, I haven't been able to use it at all. "Step 2" above completely fixed my problem. Now I don't even need to do any interactive authentication! I set about determining how to do the same procedure in Windows. Follow the same steps, but you will find the |
This is a combination of #187 (how do you indicate that you don't want to use the default service account) and how to do an OOB-ish type of flow in GCE-hosted notebooks. Now that we've inlined much more of httr to enable pseudo-OOB, it's possible that the latter is getting more in reach. |
Progress on #140 may also be relevant here. |
I think this might be solved through some combination of recent developments (some of these are only in dev gargle but I will release soon):
I'm going to close this because I am hopeful that it's solved. Even if it's not, I think it might be down to advice on usage for this context. In any case, it would be better to start with a fresh issue, if necessary, based on current gargle. |
If we're going to restart this discussion, it needs to be a fresh issue, confirming that the problem, whatever it may be, is seen with current gargle, and with a full account of what we're talking about. |
Ok. |
Manually transferring from bigrquery, since cross-org transfer is not possible.
This is about auth in GCP AI Platform Notebooks, so a combination of "on GCP" and "in a Jupyter Notebook".
r-dbi/bigrquery#340
The text was updated successfully, but these errors were encountered: