Files
nexus/wiki/concepts/测试用户.md
2026-04-21 16:03:27 +08:00

42 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
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 工具