bigrquery
bigrquery copied to clipboard
bq_auth() automatically authenticating me
I'm trying to authenticate with another email, but I'm having trouble authenticating as I usually do. I suspect it has to do with another package I must have recently updated, but hard to know for sure. I've tried everything I can think of, even reinstalling this package, but somehow its remembering my old credentials.
library(bigrquery)
bq_user()
#> NULL
bq_deauth()
bq_auth(email=NULL)
bq_user()
#> [1] "[email protected]"
bq_token()
#> <request>
#> Auth token: Token2.0
sessionInfo()
#> R version 4.0.2 (2020-06-22)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS 10.16
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] bigrquery_1.3.2.9001
#>
#> loaded via a namespace (and not attached):
#> [1] Rcpp_1.0.6 knitr_1.31 magrittr_2.0.1.9000
#> [4] tidyselect_1.1.0 bit_4.0.4 R6_2.5.0
#> [7] rlang_0.4.10 dplyr_1.0.3 httr_1.4.2
#> [10] stringr_1.4.0 styler_1.3.2 highr_0.8
#> [13] tools_4.0.2 xfun_0.20 DBI_1.1.1
#> [16] dbplyr_2.0.0 htmltools_0.5.1.1 ellipsis_0.3.1
#> [19] bit64_4.0.5 yaml_2.2.1 digest_0.6.27
#> [22] assertthat_0.2.1 gargle_0.5.0.9000 tibble_3.0.6
#> [25] lifecycle_0.2.0 crayon_1.4.0 purrr_0.3.4
#> [28] vctrs_0.3.6 fs_1.5.0 curl_4.3
#> [31] glue_1.4.2 evaluate_0.14 rmarkdown_2.6
#> [34] reprex_1.0.0 stringi_1.5.3 compiler_4.0.2
#> [37] pillar_1.4.7 generics_0.1.0 backports_1.2.1
#> [40] jsonlite_1.7.2 pkgconfig_2.0.3
Created on 2021-02-05 by the reprex package (v1.0.0)
Can you try bq_auth(email = NA)
as per the docs?
Use NA or FALSE to match nothing and force the OAuth dance in the browser
See the email
argument here:
https://bigrquery.r-dbi.org/reference/bq_auth.html
I gave that a try, but no difference:
library(bigrquery)
bq_auth(email = NA)
bq_user()
#> [1] "[email protected]"
sessionInfo()
#> R version 4.0.2 (2020-06-22)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS 10.16
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] bigrquery_1.3.2.9001
#>
#> loaded via a namespace (and not attached):
#> [1] Rcpp_1.0.6 knitr_1.31 magrittr_2.0.1.9000
#> [4] tidyselect_1.1.0 bit_4.0.4 R6_2.5.0
#> [7] rlang_0.4.10 dplyr_1.0.3 httr_1.4.2
#> [10] stringr_1.4.0 styler_1.3.2 highr_0.8
#> [13] tools_4.0.2 xfun_0.20 DBI_1.1.1
#> [16] dbplyr_2.0.0 htmltools_0.5.1.1 ellipsis_0.3.1
#> [19] bit64_4.0.5 yaml_2.2.1 digest_0.6.27
#> [22] assertthat_0.2.1 gargle_0.5.0.9000 tibble_3.0.6
#> [25] lifecycle_0.2.0 crayon_1.4.0 purrr_0.3.4
#> [28] vctrs_0.3.6 fs_1.5.0 curl_4.3
#> [31] glue_1.4.2 evaluate_0.14 rmarkdown_2.6
#> [34] reprex_1.0.0 stringi_1.5.3 compiler_4.0.2
#> [37] pillar_1.4.7 generics_0.1.0 backports_1.2.1
#> [40] jsonlite_1.7.2 pkgconfig_2.0.3
Created on 2021-02-08 by the reprex package (v1.0.0)
That is odd! I can't delve into this right now, but in the meantime here are some things that could help:
- Are you sure you've never ... set an option around the email used by gargle-using packages? See https://gargle.r-lib.org/reference/gargle_options.html for more details.
- General hints for troubleshooting gargle auth, making things more visible, seeing where your tokens are stored, etc. https://gargle.r-lib.org/articles/troubleshooting.html
It is also possible, I suppose, that you have auth'ed with the gcloud cli in the past and gargle is picking that up. It's sort of a legacy flow for application default credentials.
This is resolved now. Not sure what the root cause was for sure, but thanks for helping troubleshoot.