メインコンテンツへスキップ
クライアントを作成する前に、Vantage API での認証が必要です。詳細は「Authentication」を参照してください。

クライアントの作成

クライアントを作成するには、ヘッダーに Authorization: Bearer <access token> を設定し、{baseUrl}/api/adminapi2/v1/tenants/{tenantId}/clients/ に対して POST リクエストを、以下のリクエスト本文パラメーターとともに送信します。
ParameterDescription
clientIdクライアントの識別子。
clientNameクライアント名(例:アプリ名)。
allowOfflineAccessアクセストークンと併せてリフレッシュトークンを生成するかどうかを指定します。アプリケーションはこれを使用して、ユーザー操作なしにアクセストークンを自動更新できます。既定は False
allowRememberConsentユーザーが同意の選択を保存できるかどうかを指定します。既定は True
backChannelLogoutSessionRequiredBackchannel Logout メカニズムを必須にするかどうかを指定します。既定は True
requireClientSecretクライアントシークレットを必須にするかどうかを指定します。既定は True
requireConsent同意画面を必須にするかどうかを指定します。既定は False
allowNoPkceAuthorization Code Flow with Proof Key for Code Exchange (PKCE) 認証方式を許可するかどうかを指定します。既定は False で、Authorization Code Flow with Proof Key for Code Exchange (PKCE) 認証方式のみが許可されます。
allowedGrantTypes使用可能なグラントタイプを指定します。
allowedCorsOrigins既定の CORS(クロスオリジンリソース共有)メカニズムを使用するかどうかを指定します。
allowedScopesトークンで転送すべきリソースとユーザーデータのセットを定義します。値は正確に “openid permissions publicapi.all” である必要があります。
postLogoutRedirectUrisログアウト後のリダイレクト先として許可される URI の一覧。
redirectUris認可トークンのリダイレクトに許可された Web サイトまたはアプリの URL の一覧。URL のプレフィックスを指定できます。プレフィックスが一致する場合は任意の URL が許可されます。例: [ “https://myDomain.”, “https://myApp.myDomain.com/oauth-signin.html” ]。
accessTokenLifetime発行されたアクセストークンが Vantage へのユーザーアクセスを許可する期間を定義します。アクセストークンの既定の有効期間は 24 時間です。
refreshTokenLifetime最初のアクセストークンの発行時点からの絶対期間を定義し、その期間中は発行されたリフレッシュトークンを使用してアクセストークンを更新できます。リフレッシュトークンの既定の有効期間は 30 日です。
重要: Resource Owner Password Credentials で認証する場合は、allowRopc パラメーターを TRUE に設定する必要があります。この認証方式ではユーザーが自身の認証情報をアプリケーションに送信することを前提としているため、信頼できる機密クライアントが認証される場合にのみ ROPC の使用を推奨します。
サンプルリクエスト:

Windows の場合

curl --location --request POST "{baseUrl}/api/adminapi2/v1/tenants/{tenantId}/clients/" 
-H "accept: application/json" \
-H "Authorization: Bearer {token}"
{ 
  "clientId": "{clientId}",
  "clientName": "{clientName}", 
  "allowOfflineAccess": true,
  "allowRememberConsent": true,
  "backChannelLogoutSessionRequired": true,
  "requireClientSecret": true,    
  "requireConsent": false,  
  "allowNoPkce": true, 
  "allowedGrantTypes": [    
    "{allowedGrantTypes}"  
  ],
  "allowedCorsOrigins": [
    "{allowedCorsOrigins}"
  ],
  "allowedScopes": [ 
    "openid",
    "permissions",
    "publicapi.all" 
  ] 
  "postLogoutRedirectUris": [
     "{postLogoutRedirectUris}"
  ], 
  "redirectUris": [ 
    "{redirectUris}" 
  ]
}

Linux の場合

curl --location --request POST '{baseUrl}/api/adminapi2/v1/tenants/{tenantId}/clients/'
-H 'accept: application/json' \
-H 'Authorization: Bearer {token}'
{ 
  'clientId': '{clientId}',
  'clientName': '{clientName}', 
  'allowOfflineAccess': true,
  'allowRememberConsent': true,
  'backChannelLogoutSessionRequired': true,
  'requireClientSecret': true,    
  'requireConsent': false,  
  'allowNoPkce': true, 
  'allowedGrantTypes': [    
    '{allowedGrantTypes}'  
  ],
  'allowedCorsOrigins': [
    '{allowedCorsOrigins}'
  ],
  'allowedScopes': [ 
    'openid',
    'permissions',
    'publicapi.all' 
  ] 
  'postLogoutRedirectUris': [
     '{postLogoutRedirectUris}'
  ], 
  'redirectUris': [ 
    '{redirectUris}' 
  ]
}
サーバーからのレスポンスには、作成されたクライアントの詳細が含まれます。

シークレットの作成

各クライアントは複数のシークレットを保持できます。これにより、既存のシークレットを削除せずに、有効期限到来時に新しいシークレットへ切り替えて使用を開始できます。既定では、クライアント シークレットは6か月で失効します。 シークレットを作成するには、Authorization = Bearer <access token> ヘッダーを付与して POST リクエストを {baseUrl}/api/adminapi2/v1/tenants/{tenantId}/clients/{clientId}/secrets/ に送り、以下のリクエストボディ パラメータを指定します:
ParameterDescription
descriptionクライアント シークレットの説明。シークレットを識別しやすくする短いコメントを記載できます。任意のパラメータです。
start timeシークレットの開始日時を指定します。
expirationシークレットの有効期限(1日~3年の範囲)を指定します。例: “2021-09-07T13:03:38.380Z”。既定では、作成日からちょうど6か月後に設定されます。
サンプル リクエスト:

Windows の場合

curl --location --request POST "{baseUrl}/api/adminapi2/v1/tenants/{tenantId}/clients/{clientId}/secrets/"
-H "accept: application/json" \
-H "Authorization: Bearer {token}"
-H "Content-Type: application/json-patch+json" \ 
-d 
{ 
  "description": "{description}",
  "startTime": "{startTime}"
  "expiration": "{expiration}" 
}

Linux の場合

curl --location --request POST '{baseUrl}/api/adminapi2/v1/tenants/{tenantId}/clients/{clientId}/secrets/'
-H 'accept: application/json' \
-H 'Authorization: Bearer {token}'
-H 'Content-Type: application/json-patch+json' \ 
-d 
{ 
  'description': '{description}',
  'startTime': '{startTime}'
  'expiration': '{expiration}' 
}
サーバーからの応答には、クライアントシークレット(value)とその有効期間(startTimeexpiration)が含まれます。
重要! クライアントシークレットの値は、作成時にのみ確認できます。シークレットを使ってクライアントへのアクセスを失わないよう、安全な場所に保管してください。後からは、クライアントシークレット値の先頭 3 文字(valueDisplay)のみを表示できます。