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

Client

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

client oauth application configuration

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

屬性

屬性型別說明
idstring帶有 cid 前綴的 KSUID
resource_idstring擁有此 client 的 application 或 account
issuerstringToken 的 issuer claim
audiencestring?Token 的 audience claim
allowed_originsstring[]合法 CORS 來源
redirect_urisstring[]OAuth redirect URL
allowed_scopestring?請求 token 時允許的 scopes
default_scopestring?未提供 scope 時的預設值
access_token_configobject?Access token 設定
refresh_token_configobject?Refresh token 設定
id_token_configobject?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
  }
}

相關