42 lines
1.4 KiB
Markdown
42 lines
1.4 KiB
Markdown
---
|
||
title: "测试用户"
|
||
type: concept
|
||
tags: [google-oauth, security, testing]
|
||
---
|
||
|
||
## Definition
|
||
测试用户(Test User)是 Google OAuth 中允许未经验证(unverified)应用进行测试的 Google 账号。通过在 Google Cloud Console 的 OAuth 客户端配置中添加测试用户,可以绕过"此应用未经 Google 验证"的安全限制。
|
||
|
||
## 问题背景
|
||
|
||
首次授权未验证应用时,Google 会显示:
|
||
|
||
> 此应用未经 Google 验证
|
||
> 此应用请求访问您 Google 账号中的敏感信息。在开发者让该应用通过 Google 验证之前,请勿使用该应用。
|
||
|
||
## 添加测试用户步骤
|
||
1. 打开 [Google Cloud Console - Credentials](https://console.cloud.google.com/apis/credentials)
|
||
2. 找到目标 OAuth 客户端 ID,点击进入详情
|
||
3. 找到 **「目标对象」** → **「测试用户」** 部分
|
||
4. 点击 **「添加用户」**
|
||
5. 输入测试用 Google 邮箱地址
|
||
6. 保存
|
||
|
||
## 限制
|
||
- 仅限添加的测试用户可授权
|
||
- 仅用于开发/测试用途
|
||
- 生产环境需通过 Google 验证流程
|
||
|
||
## 典型应用场景
|
||
- **gog CLI** 配置:首次配置时需要添加测试用户才能完成 OAuth 授权
|
||
- 其他第三方 Google Workspace CLI 工具
|
||
|
||
## 相关概念
|
||
- [[OAuth]]:开放授权协议
|
||
- [[Google-Cloud-Console]]:管理测试用户的控制台
|
||
- [[API-Enablement]]:另一层授权配置
|
||
|
||
## 相关实体
|
||
- [[Google]]:OAuth 服务提供方
|
||
- [[gog CLI]]:需要测试用户配置的 CLI 工具
|