选择 Google Workspace Events API 范围

本文档包含 Google Workspace Events API 专属授权和 身份验证信息。在阅读本文档之前,请务必阅读 Google Workspace 的常规身份验证和授权信息,请访问 了解身份验证和授权

配置 OAuth 2.0 以进行授权

配置 OAuth 权限请求页面并选择范围 指定向用户显示哪些信息,以及注册 以便日后发布

Google Workspace Events API 范围

要定义向您的应用授予的访问权限级别,您需要确定并 声明授权范围。授权范围是 OAuth 2.0 URI 字符串 包含 Google Workspace 应用名称、应用访问的数据类型,以及 访问权限级别范围是您的应用为处理 Google Workspace 数据而发出的请求,包括 用户的Google 账号数据。

用户安装应用时,系统会要求用户验证使用的范围 。通常,您应选择范围最狭窄的范围 尽可能避免请求您的应用不需要的范围。用户数更多 随时向有限且明确说明的范围授予访问权限。

我们建议您尽可能使用非敏感范围,因为它按文件授予权限 访问权限范围,并缩小对应用所需特定功能的访问范围。

Google Workspace Events API 使用 Google Workspace 中的范围 支持订阅的应用。如果您的应用已使用范围 您无需额外添加 范围以使用 Google Workspace Events API。

下表显示了 Google Workspace Events API:

范围代码 说明 用法
Google Chat  
https://www.googleapis.com/auth/chat.bot 允许 Google Chat 应用查看聊天内容和发送消息。给予 使用 Chat 扩展应用提供的所有功能。 <ph type="x-smartling-placeholder"> 不敏感
https://www.googleapis.com/auth/chat.memberships 查看、添加和移除 Google Chat 对话中的成员。
敏感
https://www.googleapis.com/auth/chat.memberships.readonly 查看 Google Chat 对话中的成员。
敏感
https://www.googleapis.com/auth/chat.spaces 在 Google Chat 中创建对话和聊天室,以及查看或更新元数据(包括聊天记录设置)。 敏感内容
https://www.googleapis.com/auth/chat.spaces.readonly 在 Google Chat 中查看聊天和聊天室。
敏感
https://www.googleapis.com/auth/chat.messages.reaction 在 Chat 中查看、添加和删除对消息的回应。
敏感
https://www.googleapis.com/auth/chat.messages.reactions.readonly 在 Chat 中查看对消息的回应。
敏感
https://www.googleapis.com/auth/chat.messages 查看、撰写、发送、更新和删除消息,以及添加、查看和删除对消息的回应。 受限
https://www.googleapis.com/auth/chat.messages.readonly 在 Google Chat 中查看消息和回应。
受限
Google Meet  
https://www.googleapis.com/auth/meetings.space.created 允许应用创建、修改和读取有关会议空间的元数据 由您的应用创建而成
敏感
https://www.googleapis.com/auth/meetings.space.readonly 允许应用读取用户有权访问的任何会议空间的元数据。
敏感

上表中的“用量”列表示每个范围的敏感度 。

  • 非敏感 - 这些范围提供的是最小范围的 只需进行基本的应用验证即可授权访问。对于 请参阅准备 验证

  • 敏感 - 这些范围提供对特定 Google 用户数据的访问权限 所有事件。您需要完成 额外的应用验证有关此要求的信息,请参阅步骤 对于请求敏感的 范围

  • 受限 - 这些范围可提供对 Google 用户数据的广泛访问权限 并要求您完成受限范围内的验证流程。对于 有关此要求的信息,请参阅 Google API 服务:用户数据 政策针对特定 API 的其他要求 镜。 如果您将受限范围的数据存储在服务器上(或传输),则必须 进行安全评估

如果您的应用需要访问任何其他 Google API,您可以添加这些范围 。有关 Google API 范围的详细信息,请参阅使用 OAuth 2.0 访问 Google API

有关特定 OAuth 2.0 范围的详细信息,请参阅 OAuth 2.0 Scopes for Google API 中所述。

OAuth 验证

如果使用某些 OAuth 范围,您的应用可能需要通过 Google 的 OAuth 验证 过程。 阅读 OAuth API 验证 常见问题解答 来确定您的应用应在何时进行验证, 需要验证。另请参阅 Google 云端硬盘附加条款 服务

所需身份验证的类型

本部分介绍了需要或支持的身份验证类型。 并提供了 Google Workspace Events API。

对于 Google Chat 事件订阅,Google Workspace Events API 支持用户和应用身份验证以调用它的某些方法。如果 API 方法同时支持两种凭据,即调用中使用的凭据类型。 会影响返回的结果。例如,如果您调用 subscriptions.list() 方法,则 API 会返回一个订阅列表, 通过身份验证的用户可以访问的所有文件。如果您使用应用身份验证,API 返回应用可以访问的订阅列表。要详细了解 Chat 身份验证的类型,请参阅身份验证和授权 聊天应用和 Google Chat API 请求

下表显示了 每个 Google Workspace Events API 都需要或支持身份验证 方法:

方法 需要或支持用户身份验证 支持应用身份验证(仅限 Google Chat 应用) 支持的授权范围
创建订阅

需要每种事件类型支持的范围

  • chat.messages
  • chat.messages.readonly
  • chat.messages.reactions
  • chat.messages.reactions.readonly
  • chat.memberships
  • chat.memberships.readonly
  • chat.spaces
  • chat.spaces.readonly
  • meetings.space.created
  • meetings.space.readonly
订阅 使用用户身份验证时,此方法需要一个范围支持至少一种针对订阅的事件类型

使用应用身份验证(仅限 Google Chat 应用):

  • chat.bot
列出订阅 使用用户身份验证时,此方法需要一个范围支持至少一种针对订阅的事件类型

使用应用身份验证(仅限 Google Chat 应用):

  • chat.bot
更新订阅

需要每种事件类型支持的范围

  • chat.messages
  • chat.messages.readonly
  • chat.messages.reactions
  • chat.messages.reactions.readonly
  • chat.memberships
  • chat.memberships.readonly
  • chat.spaces
  • chat.spaces.readonly
  • meetings.space.created
  • meetings.space.readonly
重新激活订阅

需要每种事件类型支持的范围

  • chat.messages
  • chat.messages.readonly
  • chat.messages.reactions
  • chat.messages.reactions.readonly
  • chat.memberships
  • chat.memberships.readonly
  • chat.spaces
  • chat.spaces.readonly
  • meetings.space.created
  • meetings.space.readonly
删除订阅 使用用户身份验证时,此方法需要一个范围,该范围支持至少一种针对订阅的事件类型

使用应用身份验证(仅限 Google Chat 应用):

  • chat.bot

范围(按事件类型)

使用用户身份验证调用 Google Workspace Events API 时,您: 必须指定一个或多个范围,这些范围与 订阅。

下表显示了每个选项支持的授权范围 事件类型:

事件 事件类型 支持授权范围
Google Chat  
发布或更新帖子
  • google.workspace.chat.message.v1.created
  • google.workspace.chat.message.v1.updated
  • chat.messages
  • chat.messages.readonly
您添加或移除了回应,或者更改了多个回应。
  • google.workspace.chat.reaction.v1.created
  • google.workspace.chat.reaction.v1.deleted
  • google.workspace.chat.reaction.v1.batchChanged
  • chat.messages.reactions
  • chat.messages.reactions.readonly
  • chat.messages
  • chat.messages.readonly
会员服务 创建、更新或移除多个成员资格 更改。
  • google.workspace.chat.membership.v1.created
  • google.workspace.chat.membership.v1.updated
  • google.workspace.chat.membership.v1.deleted
  • google.workspace.chat.membership.v1.batchChanged
  • chat.memberships
  • chat.memberships.readonly
更新或删除聊天室
  • google.workspace.chat.space.v1.updated
  • google.workspace.chat.space.v1.deleted
  • chat.spaces
  • chat.spaces.readonly
Google Meet  
会议开始或结束。
  • google.workspace.meet.conference.v2.started
  • google.workspace.meet.conference.v2.ended
  • meetings.space.created
  • meetings.space.readonly
参与者加入或退出会议。
  • google.workspace.meet.participant.v2.joined
  • google.workspace.meet.participant.v2.left
  • meetings.space.created
  • meetings.space.readonly
生成了一条录音
  • google.workspace.meet.recording.v2.fileGenerated
  • meetings.space.created
  • meetings.space.readonly
已生成转录内容
  • google.workspace.meet.transcript.v2.fileGenerated
  • meetings.space.created
  • meetings.space.readonly