listWebAuthnCredentials method

Future<ListWebAuthnCredentialsResponse> listWebAuthnCredentials({
  1. required String accessToken,
  2. int? maxResults,
  3. String? nextToken,
})

Generates a list of the currently signed-in user's registered passkey, or WebAuthn, credentials.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

May throw ForbiddenException. May throw InternalErrorException. May throw InvalidParameterException. May throw LimitExceededException. May throw NotAuthorizedException. May throw OperationNotEnabledException. May throw PasswordResetRequiredException. May throw TooManyRequestsException.

Parameter accessToken : A valid access token that Amazon Cognito issued to the currently signed-in user. Must include a scope claim for aws.cognito.signin.user.admin.

Parameter maxResults : The maximum number of the user's passkey credentials that you want to return.

Parameter nextToken : This API operation returns a limited number of results. The pagination token is an identifier that you can present in an additional API request with the same parameters. When you include the pagination token, Amazon Cognito returns the next set of items after the current list. Subsequent requests return a new pagination token. By use of this token, you can paginate through the full list of items.

Implementation

Future<ListWebAuthnCredentialsResponse> listWebAuthnCredentials({
  required String accessToken,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    0,
    20,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'AWSCognitoIdentityProviderService.ListWebAuthnCredentials'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    signed: false,
    // TODO queryParams
    headers: headers,
    payload: {
      'AccessToken': accessToken,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return ListWebAuthnCredentialsResponse.fromJson(jsonResponse.body);
}