如何使用服务帐户和bigrquery软件包进行身份验证

如何使用服务帐户和bigrquery软件包进行身份验证

本文介绍了如何使用服务帐户和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身份验证.

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软件包进行身份验证?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 18:10