completeWebAuthnRegistration method

Future<void> completeWebAuthnRegistration({
  1. required String accessToken,
  2. required Object credential,
})

Completes registration of a passkey authenticator for the currently signed-in user.

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. May throw WebAuthnChallengeNotFoundException. May throw WebAuthnClientMismatchException. May throw WebAuthnCredentialNotSupportedException. May throw WebAuthnNotEnabledException. May throw WebAuthnOriginNotAllowedException. May throw WebAuthnRelyingPartyMismatchException.

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 credential : A RegistrationResponseJSON public-key credential response from the user's passkey provider.

Implementation

Future<void> completeWebAuthnRegistration({
  required String accessToken,
  required Object credential,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'AWSCognitoIdentityProviderService.CompleteWebAuthnRegistration'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    signed: false,
    // TODO queryParams
    headers: headers,
    payload: {
      'AccessToken': accessToken,
      'Credential': credential,
    },
  );
}