ADC(应用程序默认凭据)工作流程是否仅支持 Google Cloud API(例如,支持 Google Cloud Storage API,但不支持 Google Sheet API)?
我指的是google.auth 的默认方法- 不必在代码中存储任何私钥是一个巨大的胜利,也是有效利用 ADC(应用程序默认凭据)设置的主要好处。
GOOGLE_APPLICATION_CREDENTIALS如果我将环境变量设置为私钥文件(例如 key.json),则以下代码将有效。default这与包中步骤 1 的方法一致google.auth: 1. If the environment variable GOOGLE_APPLICATION_CREDENTIALS is set to the path of a valid service account JSON private key file, then it is loaded and returned.
import google.auth
from apiclient import discovery
credentials, project_id = google.auth.default(scopes=['https://www.googleapis.com/auth/spreadsheets'])
sheets = discovery.build('sheets', 'v4', credentials=credentials)
SPREADSHEETID = '....'
result = sheets.spreadsheets().values().get(spreadsheetId=SPREADSHEETID, range='Sheet1!A:B').execute()
print result.get('values', [])
Run Code Online (Sandbox Code Playgroud)
现在,看看该方法的第 4 步: …
python google-authentication google-compute-engine google-cloud-platform google-sheets-api
我有一个 NodeJS API,需要使用 Google Sheets API V4 数据来填充数据库。
我一直在查看有关如何进行身份验证的文档,但我发现进行身份验证的所有方式都需要执行用户交互才能获取刷新的令牌
我需要一种无需与用户和浏览器交互即可执行身份验证的方法,有人可以帮助我吗?
Documentation I'm following: https://developers.google.com/sheets/api/
Thanks!
我正在尝试构建这个应用程序,我计划将我的数据存储在 Firestore 数据库中。我的客户需要 Google 表格中的数据。
我是否可以使用 Cloud Function 直接将 Firestore 中的记录填充到 Google Sheet,并且每当将新记录添加到 Firestore 时,Google Sheet 都会自动更新?
有人可以建议任何对这个主题有帮助的资源吗?