Client
Client 是一个 OAuth 2.0 应用,用于认证用户并请求令牌。客户端定义允许来源、回调 URI 和令牌配置。
Schema
interface Client {
id: string; // "cid..." - Unique identifier
resource_id: string; // Owning application or account
issuer: string;
audience: string | null;
allowed_origins: string[];
redirect_uris: string[];
allowed_scope: string | null;
default_scope: string | null;
access_token_config: TokenConfig | null;
refresh_token_config: TokenConfig | null;
id_token_config: TokenConfig | null;
}
interface TokenConfig {
expires_in: number;
cookie_options?: {
http_only?: boolean;
secure?: boolean;
same_site?: "lax" | "strict" | "none";
};
}
属性
| 属性 | 类型 | 说明 |
|---|---|---|
id | string | 带 cid 前缀的 KSUID |
resource_id | string | 拥有该客户端的应用或账户 |
issuer | string | 令牌中的 issuer 声明 |
audience | string? | 令牌中的 audience 声明 |
allowed_origins | string[] | 合法 CORS 来源 |
redirect_uris | string[] | OAuth 回调地址 |
allowed_scope | string? | 令牌请求允许的 scope |
default_scope | string? | 未提供 scope 时使用的默认值 |
access_token_config | object? | 访问令牌设置 |
refresh_token_config | object? | 刷新令牌设置 |
id_token_config | object? | ID 令牌设置 |
示例
{
"id": "cid_2kHfPZcN9xW4mE8RtY7vB",
"resource_id": "app_root",
"issuer": "https://auth.example.com",
"audience": "https://api.example.com",
"allowed_origins": ["https://app.example.com"],
"redirect_uris": ["https://app.example.com/callback"],
"access_token_config": {
"expires_in": 3600
},
"refresh_token_config": {
"expires_in": 1209600
}
}
相关
- 客户端 - 客户端管理
- Client Key - 签名密钥
- OAuth - OAuth 流程