resetUserPassword method

Future<ResetUserPasswordResponse> resetUserPassword({
  1. required String userId,
  2. String? clientToken,
})

Resets the password for a specified user ID and generates a temporary one. Only a superuser can reset password for other users. Resetting the password immediately invalidates the previous password associated with the user.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter userId : The unique identifier of the user that a temporary password is requested for.

Parameter clientToken : A token that ensures idempotency. This token expires in 10 minutes.

Implementation

Future<ResetUserPasswordResponse> resetUserPassword({
  required String userId,
  String? clientToken,
}) async {
  final $payload = <String, dynamic>{
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/user/${Uri.encodeComponent(userId)}/password',
    exceptionFnMap: _exceptionFns,
  );
  return ResetUserPasswordResponse.fromJson(response);
}