verifyPassword method

Future<VerifyPassword200Response?> verifyPassword(
  1. String userId, {
  2. VerifyPasswordRequest? verifyPasswordRequest,
})

Verify the password of a user

Check that the user's password matches the supplied input. Useful for custom auth flows and re-verification.

Parameters:

Implementation

Future<VerifyPassword200Response?> verifyPassword(
  String userId, {
  VerifyPasswordRequest? verifyPasswordRequest,
}) async {
  final response = await verifyPasswordWithHttpInfo(
    userId,
    verifyPasswordRequest: verifyPasswordRequest,
  );
  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),
      'VerifyPassword200Response',
    ) as VerifyPassword200Response;
  }
  return null;
}