コンテンツにスキップ

クライアント管理

概要

クライアント管理APIは、OAuthクライアントアプリケーションの登録、設定、シークレット管理を行うエンドポイントを提供します。

エンドポイント一覧

メソッドエンドポイント説明
GET/api/admin/clientsクライアント一覧取得
GET/api/admin/clients/:idクライアント詳細取得
POST/api/admin/clientsクライアント作成
PUT/api/admin/clients/:idクライアント更新
DELETE/api/admin/clients/:idクライアント削除
POST/api/admin/clients/:id/rotate-secretシークレット再生成
POST/api/admin/clients/:id/enableクライアント有効化
POST/api/admin/clients/:id/disableクライアント無効化

クライアント一覧取得

登録されているOAuthクライアントの一覧を取得します。

エンドポイント

GET /api/admin/clients

クエリパラメータ

パラメータ必須説明
limitinteger-取得件数(デフォルト: 20、最大: 100)
cursorstring-ページネーションカーソル
typestring-クライアントタイプ(web, native, spa, m2m
statusstring-ステータス(active, disabled

リクエスト例

Terminal window
curl -X GET "https://{tenant-domain}/api/admin/clients?type=web" \
-H "Authorization: Bearer {token}"

レスポンス例

{
"items": [
{
"id": "client_abc123",
"name": "My Web App",
"type": "web",
"status": "active",
"redirect_uris": ["https://myapp.example.com/callback"],
"created_at": 1705881600,
"updated_at": 1705968000
}
],
"total": 5,
"cursor": null
}

クライアント詳細取得

指定されたクライアントの詳細情報を取得します。

エンドポイント

GET /api/admin/clients/:id

パスパラメータ

パラメータ必須説明
idstringクライアントID

リクエスト例

Terminal window
curl -X GET "https://{tenant-domain}/api/admin/clients/client_abc123" \
-H "Authorization: Bearer {token}"

レスポンス例

{
"id": "client_abc123",
"name": "My Web App",
"description": "メインWebアプリケーション",
"type": "web",
"status": "active",
"redirect_uris": [
"https://myapp.example.com/callback",
"https://myapp.example.com/silent-callback"
],
"post_logout_redirect_uris": [
"https://myapp.example.com/"
],
"allowed_origins": [
"https://myapp.example.com"
],
"grant_types": ["authorization_code", "refresh_token"],
"response_types": ["code"],
"token_endpoint_auth_method": "client_secret_post",
"scopes": ["openid", "profile", "email"],
"id_token_lifetime": 3600,
"access_token_lifetime": 3600,
"refresh_token_lifetime": 2592000,
"created_at": 1705881600,
"updated_at": 1705968000
}

クライアント作成

新しいOAuthクライアントを登録します。

エンドポイント

POST /api/admin/clients

リクエストボディ

フィールド必須説明
namestringクライアント名
typestringクライアントタイプ(web, native, spa, m2m
descriptionstring-説明
redirect_urisstring[]リダイレクトURI一覧
post_logout_redirect_urisstring[]-ログアウト後リダイレクトURI
allowed_originsstring[]-許可オリジン(CORS)
grant_typesstring[]-許可するグラントタイプ
response_typesstring[]-許可するレスポンスタイプ
token_endpoint_auth_methodstring-トークンエンドポイント認証方式
scopesstring[]-許可するスコープ
id_token_lifetimeinteger-IDトークン有効期間(秒)
access_token_lifetimeinteger-アクセストークン有効期間(秒)
refresh_token_lifetimeinteger-リフレッシュトークン有効期間(秒)

クライアントタイプ

タイプ説明推奨認証方式
webサーバーサイドWebアプリclient_secret_post/basic
nativeネイティブアプリ(iOS, Android)none (PKCE)
spaシングルページアプリnone (PKCE)
m2mマシン間通信client_secret_post/basic

リクエスト例

Terminal window
curl -X POST "https://{tenant-domain}/api/admin/clients" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"name": "New Web App",
"type": "web",
"description": "新規Webアプリケーション",
"redirect_uris": ["https://newapp.example.com/callback"],
"grant_types": ["authorization_code", "refresh_token"],
"scopes": ["openid", "profile", "email"]
}'

レスポンス例

{
"id": "client_xyz789",
"name": "New Web App",
"type": "web",
"status": "active",
"client_secret": "cs_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"redirect_uris": ["https://newapp.example.com/callback"],
"created_at": 1706140800
}

クライアント更新

既存のクライアント設定を更新します。

エンドポイント

PUT /api/admin/clients/:id

リクエスト例

Terminal window
curl -X PUT "https://{tenant-domain}/api/admin/clients/client_abc123" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Web App",
"redirect_uris": [
"https://myapp.example.com/callback",
"https://myapp.example.com/callback2"
]
}'

クライアント削除

クライアントを削除します。

エンドポイント

DELETE /api/admin/clients/:id

リクエスト例

Terminal window
curl -X DELETE "https://{tenant-domain}/api/admin/clients/client_abc123" \
-H "Authorization: Bearer {token}"

レスポンス

ステータスコード 204 No Content(ボディなし)


シークレット再生成

クライアントシークレットを再生成します。

エンドポイント

POST /api/admin/clients/:id/rotate-secret

リクエスト例

Terminal window
curl -X POST "https://{tenant-domain}/api/admin/clients/client_abc123/rotate-secret" \
-H "Authorization: Bearer {token}"

レスポンス例

{
"id": "client_abc123",
"client_secret": "cs_yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
"rotated_at": 1706227200
}

クライアント有効化

無効化されているクライアントを有効化します。

エンドポイント

POST /api/admin/clients/:id/enable

リクエスト例

Terminal window
curl -X POST "https://{tenant-domain}/api/admin/clients/client_abc123/enable" \
-H "Authorization: Bearer {token}"

レスポンス例

{
"id": "client_abc123",
"status": "active",
"enabled_at": 1706313600
}

クライアント無効化

クライアントを一時的に無効化します。無効化されたクライアントはトークンを発行できません。

エンドポイント

POST /api/admin/clients/:id/disable

リクエスト例

Terminal window
curl -X POST "https://{tenant-domain}/api/admin/clients/client_abc123/disable" \
-H "Authorization: Bearer {token}"

レスポンス例

{
"id": "client_abc123",
"status": "disabled",
"disabled_at": 1706400000
}