本文介绍了如何使用服务帐户和 bigrquery 包进行身份验证?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have been able to authenticate using the json file associated with a service account using googleAuth and bigQueryR.

# 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 中的函数.

This works and I am able to start using functions from bigQueryR.

现在假设我仅限于 bigrquery 包,我如何使用带有此包的服务帐户进行身份验证?

Now assume I am limited to the bigrquery package, how can I authenticate using a service account with this package?

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

I have looked at the documentation here to no avail:https://cran.r-project.org/web/packages/bigrquery/bigrquery.pdf

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

The resources I have come across on the internet propose using thebigQueryR package in place of bigrquery.

例如这个相关的stackoverflow问题:在闪亮的应用程序中使用 bigrquery auth.

For instance this related stackoverflow question:Use bigrquery auth in shiny application.

但我需要仅在 bigrquery 中可用的函数.

But I need functions only available in bigrquery.

推荐答案

set_service_token() 现已弃用.

使用 bq_auth() 代替:

bq_auth(path = "location_of_service_token.json")

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

这篇关于如何使用服务帐户和 bigrquery 包进行身份验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-26 23:06