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

クライアントの作成

クライアントを作成するには、{baseUrl}/api/adminapi2/v1/tenants/{tenantId}/clients/ に対して、ヘッダー Authorization = Bearer <access token> を付与した POST リクエストを、以下のリクエスト本文パラメーターとともに送信します:
Parameter説明
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認可トークンのリダイレクトを許可するウェブサイトまたはアプリの URL のホワイトリスト。URL のプレフィックスを許可します。プレフィックスが一致する場合、任意の URL が許可されます。例: [ “https://myDomain.”, “https://myApp.myDomain.com/oauth-signin.html” ]。
重要! 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/ に送信し、以下のリクエスト本文パラメーターを指定します:
Parameter説明
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)のみを参照できます。