Skip to content

complete_web_authn_registration

complete_web_authn_registration(
    access_token: TokenModelType,
    credential: Document,
    *,
    config_overrides: Optional[CognitoIdentityProviderClientConfig] = None,
) -> CompleteWebAuthnRegistrationResponse

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.

Parameters:

  • access_token (TokenModelType) –

    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.

  • credential (Document) –

    A RegistrationResponseJSON public-key credential response from the user's passkey provider.

Raises:

  • ForbiddenException –

    This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

  • InternalErrorException –

    This exception is thrown when Amazon Cognito encounters an internal error.

  • InvalidParameterException –

    This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

  • LimitExceededException –

    This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.

  • NotAuthorizedException –

    This exception is thrown when a user isn't authorized.

  • OperationNotEnabledException –

    This exception is thrown when an operation is not available in the current region or for the current user pool configuration. This can occur when attempting to perform operations that are not supported in secondary replica regions.

  • PasswordResetRequiredException –

    This exception is thrown when a password reset is required.

  • TooManyRequestsException –

    This exception is thrown when the user has made too many requests for a given operation.

  • WebAuthnChallengeNotFoundException –

    This exception is thrown when the challenge from StartWebAuthn registration has expired.

  • WebAuthnClientMismatchException –

    This exception is thrown when the access token is for a different client than the one in the original StartWebAuthnRegistration request.

  • WebAuthnCredentialNotSupportedException –

    This exception is thrown when a user presents passkey credentials from an unsupported device or provider.

  • WebAuthnNotEnabledException –

    This exception is thrown when the passkey feature isn't enabled for the user pool.

  • WebAuthnOriginNotAllowedException –

    This exception is thrown when the passkey credential's registration origin does not align with the user pool relying party id.

  • WebAuthnRelyingPartyMismatchException –

    This exception is thrown when the given passkey credential is associated with a different relying party ID than the user pool relying party ID.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_cognito_identity_provider/_services/cognito_identity_provider.py
def complete_web_authn_registration(
    self,
    access_token: "capo_cognito_identity_provider.types.token_model_type.TokenModelType",
    credential: "capo_cognito_identity_provider.types.document.Document",
    *,
    config_overrides: Optional[CognitoIdentityProviderClientConfig] = None,
) -> "capo_cognito_identity_provider.types.complete_web_authn_registration_response.CompleteWebAuthnRegistrationResponse":
    """<p>Completes registration of a passkey authenticator for the currently signed-in user.</p> <p>Authorize this action with a signed-in user's access token. It must include the scope <code>aws.cognito.signin.user.admin</code>.</p>

    Args:
        access_token: <p>A valid access token that Amazon Cognito issued to the currently signed-in user. Must include a scope claim for <code>aws.cognito.signin.user.admin</code>.</p>
        credential: <p>A <a href="https://www.w3.org/TR/WebAuthn-3/#dictdef-registrationresponsejson">RegistrationResponseJSON</a> public-key credential response from the user's passkey provider.</p>

    Raises:
        capo_cognito_identity_provider.errors.forbidden_exception.ForbiddenException: <p>This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.</p>
        capo_cognito_identity_provider.errors.internal_error_exception.InternalErrorException: <p>This exception is thrown when Amazon Cognito encounters an internal error.</p>
        capo_cognito_identity_provider.errors.invalid_parameter_exception.InvalidParameterException: <p>This exception is thrown when the Amazon Cognito service encounters an invalid parameter.</p>
        capo_cognito_identity_provider.errors.limit_exceeded_exception.LimitExceededException: <p>This exception is thrown when a user exceeds the limit for a requested Amazon Web Services resource.</p>
        capo_cognito_identity_provider.errors.not_authorized_exception.NotAuthorizedException: <p>This exception is thrown when a user isn't authorized.</p>
        capo_cognito_identity_provider.errors.operation_not_enabled_exception.OperationNotEnabledException: <p>This exception is thrown when an operation is not available in the current region or for the current user pool configuration. This can occur when attempting to perform operations that are not supported in secondary replica regions.</p>
        capo_cognito_identity_provider.errors.password_reset_required_exception.PasswordResetRequiredException: <p>This exception is thrown when a password reset is required.</p>
        capo_cognito_identity_provider.errors.too_many_requests_exception.TooManyRequestsException: <p>This exception is thrown when the user has made too many requests for a given operation.</p>
        capo_cognito_identity_provider.errors.web_authn_challenge_not_found_exception.WebAuthnChallengeNotFoundException: <p>This exception is thrown when the challenge from <code>StartWebAuthn</code> registration has expired.</p>
        capo_cognito_identity_provider.errors.web_authn_client_mismatch_exception.WebAuthnClientMismatchException: <p>This exception is thrown when the access token is for a different client than the one in the original <code>StartWebAuthnRegistration</code> request.</p>
        capo_cognito_identity_provider.errors.web_authn_credential_not_supported_exception.WebAuthnCredentialNotSupportedException: <p>This exception is thrown when a user presents passkey credentials from an unsupported device or provider.</p>
        capo_cognito_identity_provider.errors.web_authn_not_enabled_exception.WebAuthnNotEnabledException: <p>This exception is thrown when the passkey feature isn't enabled for the user pool.</p>
        capo_cognito_identity_provider.errors.web_authn_origin_not_allowed_exception.WebAuthnOriginNotAllowedException: <p>This exception is thrown when the passkey credential's registration origin does not align with the user pool relying party id.</p>
        capo_cognito_identity_provider.errors.web_authn_relying_party_mismatch_exception.WebAuthnRelyingPartyMismatchException: <p>This exception is thrown when the given passkey credential is associated with a different relying party ID than the user pool relying party ID.</p>
        capo_cognito_identity_provider.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cognito_identity_provider.types.complete_web_authn_registration_request.CompleteWebAuthnRegistrationRequest]",
    ) -> OperationResponse[
        "capo_cognito_identity_provider.types.complete_web_authn_registration_response.CompleteWebAuthnRegistrationResponse"
    ]:
        import capo_cognito_identity_provider._operations.aws_cognito_identity_provider_service.complete_web_authn_registration

        output, http_response = (
            capo_cognito_identity_provider._operations.aws_cognito_identity_provider_service.complete_web_authn_registration.complete_web_authn_registration(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_cognito_identity_provider.types.complete_web_authn_registration_request.CompleteWebAuthnRegistrationRequest",
    ) -> dict[str, Any]:
        import capo_cognito_identity_provider.types.complete_web_authn_registration_request

        return capo_cognito_identity_provider.types.complete_web_authn_registration_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CompleteWebAuthnRegistration", redact_input=_redact_input
        ),
    )
    input_: capo_cognito_identity_provider.types.complete_web_authn_registration_request.CompleteWebAuthnRegistrationRequest = {
        "access_token": access_token,
        "credential": credential,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output