AM
ZH-TW
免費開始
選單
類型

Client

驗證與 token 設定使用的 OAuth 2.0 用戶端應用程式配置。

clientoauthapplicationconfiguration

Client

Client 是 OAuth 2.0 應用程式,負責驗證使用者並請求 token。Client 定義允許的來源、redirect URI 與 token 設定。

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 擁有此 client 的 application 或 account
issuer string Token 的 issuer claim
audience string? Token 的 audience claim
allowed_origins string[] 合法 CORS 來源
redirect_uris string[] OAuth redirect URL
allowed_scope string? 請求 token 時允許的 scopes
default_scope string? 未提供 scope 時的預設值
access_token_config object? Access token 設定
refresh_token_config object? Refresh token 設定
id_token_config object? ID token 設定

範例

{
  "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
  }
}

相關