在`googlesheets`中使用`googleAuthR`中的令牌

问题描述 投票:1回答:1

googleAuthR是一个R包,用于包装google API客户端库(API的身份验证和进一步使用)。googlesheetsR包用于与Google表格API(即Google表格API的包装器)集成。

这些软件包中的每个软件包都有各自的OAuth2.0进程。我正在使用googleAuthR登录到一个闪亮的应用程序,该应用程序进而也使用了googlesheets库(但具有不同的身份验证过程)。

问题:我们如何设置googlesheets包也使用初始googleAuthR凭据?

这是我正在使用的过程(在闪亮的应用程序内:)>

对于我正在使用的googleAuthR登录名:

options(googleAuthR.webapp.client_secret = "***REMOVED_FROM_EXAMPLE***")
options(googleAuthR.webapp.client_id = "***REMOVED_FROM_EXAMPLE***")
options(googleAuthR.scopes.selected = c("https://www.googleapis.com/auth/userinfo.email",
                                        "https://www.googleapis.com/auth/userinfo.profile",
                                        "https://www.googleapis.com/auth/spreadsheets"))

[对于googlesheets软件包,我目前正在使用预先注册的(单独的)令牌,该令牌已按照该软件包的插图中的说明保存到RDS文件中:

suppressMessages(gs_auth(token = "googlesheets_token.rds", verbose = FALSE))
gsheet_log <- googlesheets::gs_url("https://docs.google.com/spreadsheets/d/***REMOVED_FROM_EXAMPLE***/edit#gid=0")

我想用用gs_auth生成的令牌代替googleAuthR的使用的流程。

[googleAuthR是一个R包,它包装了google API客户端库(API的身份验证和进一步使用)。 googlesheets R软件包用于与googlesheets API集成(即...

r google-sheets shiny google-authentication
1个回答
0
投票

您可以尝试使用服务帐户令牌代替身份验证吗? https://gargle.r-lib.org/articles/get-api-credentials.html

© www.soinside.com 2019 - 2024. All rights reserved.