registerClient method

Future<RegisterClientResponse> registerClient({
  1. required String clientName,
  2. required String clientType,
  3. String? entitledApplicationArn,
  4. List<String>? grantTypes,
  5. String? issuerUrl,
  6. List<String>? redirectUris,
  7. List<String>? scopes,
})

Registers a public client with IAM Identity Center. This allows clients to perform authorization using the authorization code grant with Proof Key for Code Exchange (PKCE) or the device code grant.

May throw InternalServerException. May throw InvalidClientMetadataException. May throw InvalidRedirectUriException. May throw InvalidRequestException. May throw InvalidScopeException. May throw SlowDownException. May throw UnsupportedGrantTypeException.

Parameter clientName : The friendly name of the client.

Parameter clientType : The type of client. The service supports only public as a client type. Anything other than public will be rejected by the service.

Parameter entitledApplicationArn : This IAM Identity Center application ARN is used to define administrator-managed configuration for public client access to resources. At authorization, the scopes, grants, and redirect URI available to this client will be restricted by this application resource.

Parameter grantTypes : The list of OAuth 2.0 grant types that are defined by the client. This list is used to restrict the token granting flows available to the client. Supports the following OAuth 2.0 grant types: Authorization Code, Device Code, and Refresh Token.

  • Authorization Code - authorization_code

  • Device Code - urn:ietf:params:oauth:grant-type:device_code

  • Refresh Token - refresh_token

Parameter issuerUrl : The IAM Identity Center Issuer URL associated with an instance of IAM Identity Center. This value is needed for user access to resources through the client.

Parameter redirectUris : The list of redirect URI that are defined by the client. At completion of authorization, this list is used to restrict what locations the user agent can be redirected back to.

Parameter scopes : The list of scopes that are defined by the client. Upon authorization, this list is used to restrict permissions when granting an access token.

Implementation

Future<RegisterClientResponse> registerClient({
  required String clientName,
  required String clientType,
  String? entitledApplicationArn,
  List<String>? grantTypes,
  String? issuerUrl,
  List<String>? redirectUris,
  List<String>? scopes,
}) async {
  final $payload = <String, dynamic>{
    'clientName': clientName,
    'clientType': clientType,
    if (entitledApplicationArn != null)
      'entitledApplicationArn': entitledApplicationArn,
    if (grantTypes != null) 'grantTypes': grantTypes,
    if (issuerUrl != null) 'issuerUrl': issuerUrl,
    if (redirectUris != null) 'redirectUris': redirectUris,
    if (scopes != null) 'scopes': scopes,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/client/register',
    signed: false,
    exceptionFnMap: _exceptionFns,
  );
  return RegisterClientResponse.fromJson(response);
}