客户端 ID 和客户端密钥生成器

在浏览器中生成随机 OAuth 客户端 ID 和客户端密钥,可设置前缀、密钥长度和数量。

// about

工具介绍

此工具在浏览器本地生成随机客户端 ID 和密钥,适合开发和测试集成。请将生成的密钥保存到安全的密钥管理工具中。

如何使用

  1. 输入客户端 ID 前缀、密钥长度和生成数量。
  2. 点击生成并检查生成的客户端 ID 和密钥。
  3. 复制结果并保存到安全的密钥库;清除后无法恢复。

人们为何使用此工具

  • 几秒钟生成多个带自定义前缀的客户端凭据。
  • 可选择 24 到 128 个字符的密钥长度。
  • 凭据在浏览器中生成,不会发送到服务器。

常见问题解答 (FAQ)

生成的凭据会被保存吗?

不会。凭据在浏览器中生成,页面不会保存输出。

密钥最长可以设置多少?

可以选择 24 到 128 个字符。

可以在生产环境使用吗?

建议用于开发和测试。生产环境请遵循服务商政策,并使用托管密钥库。

指南 · 安全 · 约 3 分钟

如何设置强密码:长度、熵与密码管理器

“至少包含一个特殊字符”这类规则大家都很熟悉,但真正让密码变强的是随机性和长度。算一算就能清楚看出为什么有些密码很弱。

攻击者主要使用三种方法:撞库,即用从其他网站泄露的用户名和密码去尝试登录;字典攻击,即尝试常见密码和单词;以及暴力破解,即尝试所有组合。

6 位数字              : 6 × log2(10)  ≈ 20 比特
16 个随机小写字母     : 16 × log2(26) ≈ 75 比特
从 94 种中随机选 12 个 : 12 × log2(94) ≈ 79 比特
16 个随机字母和数字   : 16 × log2(62) ≈ 95 比特
如何计算密码熵、为什么长度比复杂度规则更有效、应避免哪些模式,以及如何使用密码管理器。
阅读指南 →
用 AI 自己做

用 AI 亲手打造这个工具

想要自己的版本?把下面的任务提示词粘贴到 AI 聊天中,或将技能文件保存到 AI 编程助手。其中包含我们开发此工具时整理的功能、边界情况和测试用例。

提示词和技能以英文提供,AI 工具在任何语言环境下都能很好地理解。

AI 任务提示词

直接粘贴到 Claude、ChatGPT、Gemini 等 AI 聊天中即可。

You are an experienced full-stack web developer. Build a web tool called "客户端凭据生成器" that meets the requirements below.

## Goal

Build a tool that securely generates client IDs and client secrets for API integrations.

## Core features

- Client IDs with a prefix (e.g. app_)
- Secrets with selectable length and character set
- Base64URL or hex output
- Preview as .env variables
- Copy each item

## Inputs

- Prefix, secret length in bytes, output format

## Outputs

- Client ID
- Client secret
- .env formatted text

## Edge cases and handling rules

- Recommend at least 32 bytes for secrets
- Never send or store generated values on a server
- Use only URL- and header-safe characters
- Warn that values disappear on refresh

## Implementation requirements

- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.
- Make the UI responsive and easy to use on mobile; label every input and keep everything keyboard accessible.
- Add a Copy button for results and show clear, friendly error messages for invalid input.
- Keep the core logic in functions separate from the UI so it can be unit-tested.

## Definition of done (test cases)

- A 32-byte Base64URL secret is 43 characters without padding
- Consecutive values differ
- IDs start with the chosen prefix

First outline your implementation plan in at most five lines, then write the complete code, and finally explain how to check the test cases above.

技能 (SKILL.md)

在 Claude Code 等 AI 编程助手中保存为 .claude/skills/build-client-credential-generator/SKILL.md,以后开发或修改此工具时可重复使用。

---
name: build-client-credential-generator
description: Use when building or changing a 客户端凭据生成器 tool. Build a tool that securely generates client IDs and client secrets for API integrations.
---

# Build: 客户端凭据生成器

## Goal

Build a tool that securely generates client IDs and client secrets for API integrations.

## Workflow

1. Review the required features, inputs and outputs below and ask about anything missing first.
2. Implement the core logic as pure functions separate from the UI.
3. Check the logic against the test cases in the verification list.
4. Build a responsive UI with an input form, a result area and a Copy button.
5. Reproduce each edge case listed under Rules and refine the error messages.

## Core features

- Client IDs with a prefix (e.g. app_)
- Secrets with selectable length and character set
- Base64URL or hex output
- Preview as .env variables
- Copy each item

## Inputs

- Prefix, secret length in bytes, output format

## Outputs

- Client ID
- Client secret
- .env formatted text

## Rules

- Recommend at least 32 bytes for secrets
- Never send or store generated values on a server
- Use only URL- and header-safe characters
- Warn that values disappear on refresh
- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.

## Verification

- [ ] A 32-byte Base64URL secret is 43 characters without padding
- [ ] Consecutive values differ
- [ ] IDs start with the chosen prefix

交给 AI 时的小技巧

  • 在第一行写明技术栈(如 React、Vue 或纯 HTML),生成的代码会更贴合你的项目。
  • 在接受代码前,请让 AI 运行列出的测试用例并展示结果。
  • 不要把真实密码、客户数据或 API 密钥粘贴到提示词中,请用示例值代替。