registerOAuthClient method

Future<ClientRegistrationResponse?> registerOAuthClient(
  1. ClientRegistrationRequest clientRegistrationRequest
)

Register a new OAuth 2.1 client (RFC 7591 dynamic client registration).

Returns a fresh client_id (and, for confidential clients, client_secret) plus a one-time registration_access_token the client can use later to update its registration. Public clients (mobile, SPA) MUST use token_endpoint_auth_method: none and PKCE. Rate-limited to 10 registrations per hour per source IP.

Parameters:

Implementation

Future<ClientRegistrationResponse?> registerOAuthClient(ClientRegistrationRequest clientRegistrationRequest,) async {
  final response = await registerOAuthClientWithHttpInfo(clientRegistrationRequest,);
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ClientRegistrationResponse',) as ClientRegistrationResponse;

  }
  return null;
}