首页 > 解决方案 > gsheets颤动如何添加凭据

问题描述

我正在尝试集成颤振gsheets(用于使用 Google Sheets API v4 的库。)它说要添加

    const _credentials = r'''
  {
  "type": "service_account",
  "project_id": "",
  "private_key_id": "",
  "private_key": "",
  "client_email": "",
  "client_id": "",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": ""
}
''';
// your spreadsheet id
const _spreadsheetId = '';

在这里我不确定如何使用它。我已按照 gsheets 库文档中有关入门和步骤的说明启用了所有 API。不幸的是,我只是不确定从哪里获得详细信息。

在互联网上找不到太多参考。请帮忙

标签: flutterdartgoogle-sheetsflutter-dependenciesdart-pub

解决方案


You can create a service account from Google, which will give you a json file with the credentials you're looking for. Google has posted some instructions here: [https://support.google.com/a/answer/7378726?hl=en][1] [1]: https://support.google.com/a/answer/7378726?hl=en.

Make sure you're careful with these credentials and keep them private; they contain some information about your service account that you wouldn't want to share with the public.


推荐阅读