在 Shiny 应用程序中使用 Google SearchConsoleR 数据

问题描述

我创建了一个 API 密钥、OAuth 2.0 客户端 ID json 文件一个服务帐户电子邮件。如何使用 searchConsoleR 包在不打开浏览器进行身份验证的情况下自动连接到 google 搜索控制台?

对于googleAnalyticsR,我做到了

googleAuthR::gar_set_client(json = here::here("credentials/client_id.json"))
googleAnalyticsR::ga_auth(email = "email",json_file = here::here("credentials/file.json"))

但是我无法连接到搜索控制台。有没有什么好的文档可以让我在没有浏览器身份验证的情况下以自动方式连接到谷歌搜索控制台?

解决方法

看看这个:

options(googleAuthR.scopes.selected = "https://www.googleapis.com/auth/webmasters")
gar_auth_service(json_file = "/service-account-key.json")