【问题标题】:How to authenticate with service account and bigrquery package?如何使用服务帐户和 bigrquery 包进行身份验证?
【发布时间】:2017-07-13 14:29:18
【问题描述】:

我已经能够使用与 googleAuthbigQueryR 的服务帐户关联的 json 文件进行身份验证。

# Load Packages
global.packages <- c("bigQueryR", "googleAuthR")

### Apply require on the list of packages; load them quietly
lapply(global.packages, require, character.only = TRUE, quietly = TRUE)

Sys.setenv("GCS_AUTH_FILE" = "json_file_location")

#Authenticate Google BQ
googleAuthR::gar_attach_auto_auth("https://www.googleapis.com/auth/bigquery",
                                  environment_var = "GCS_AUTH_FILE")

这行得通,我可以开始使用来自bigQueryR 的函数。

现在假设我仅限于 bigrquery 包,我如何使用服务帐户和这个包进行身份验证?

我查看了这里的文档无济于事: https://cran.r-project.org/web/packages/bigrquery/bigrquery.pdf

我在互联网上遇到的资源建议使用 bigQueryR 包代替 bigrquery

例如这个相关的 stackoverflow 问题: Use bigrquery auth in shiny application.

但我需要仅在 bigrquery 中可用的功能。

【问题讨论】:

    标签: r authentication server google-bigquery


    【解决方案1】:

    set_service_token() 现已弃用。

    改用bq_auth()

    bq_auth(path = "location_of_service_token.json")
    

    来源:https://rdrr.io/cran/bigrquery/man/bigrquery-deprecated.html

    【讨论】:

      【解决方案2】:

      您可以使用函数set_service_token()in bigrquery 使用您在bigQueryR 中使用的相同服务JSON 进行身份验证

      library(bigrquery)
      
      set_service_token("location-of-service.json")
      

      来源:https://github.com/rstats-db/bigrquery/issues/22

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-03-20
        • 2020-06-24
        • 2020-05-21
        • 2013-09-23
        • 2016-01-31
        相关资源
        最近更新 更多