admin_set_user_mfa_preference
async
¶
admin_set_user_mfa_preference(
username: UsernameType,
user_pool_id: UserPoolIdType,
*,
config_overrides: Optional[AsyncCognitoIdentityProviderClientConfig] = None,
sms_mfa_settings: Optional[SMSMfaSettingsType] = None,
software_token_mfa_settings: Optional[SoftwareTokenMfaSettingsType] = None,
email_mfa_settings: Optional[EmailMfaSettingsType] = None,
web_authn_mfa_settings: Optional[WebAuthnMfaSettingsType] = None,
) -> AdminSetUserMFAPreferenceResponse
Sets the user's multi-factor authentication (MFA) preference, including which MFA options are activated, and if any are preferred. Only one factor can be set as preferred. The preferred MFA factor will be used to authenticate a user if multiple factors are activated. If multiple options are activated and no preference is set, a challenge to choose an MFA option will be returned during sign-in.
Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.
Learn more
Parameters:
-
sms_mfa_settings(Optional[SMSMfaSettingsType], default:None) –User preferences for SMS message MFA. Activates or deactivates SMS MFA and sets it as the preferred MFA method when multiple methods are available.
-
software_token_mfa_settings(Optional[SoftwareTokenMfaSettingsType], default:None) –User preferences for time-based one-time password (TOTP) MFA. Activates or deactivates TOTP MFA and sets it as the preferred MFA method when multiple methods are available.
-
email_mfa_settings(Optional[EmailMfaSettingsType], default:None) –User preferences for email message MFA. Activates or deactivates email MFA and sets it as the preferred MFA method when multiple methods are available. To activate this setting, your user pool must be in the Essentials tier or higher.
-
web_authn_mfa_settings(Optional[WebAuthnMfaSettingsType], default:None) –User preferences for passkey MFA. Activates or deactivates passkey MFA for the user. When activated, passkey authentication requires user verification, and passkey sign-in is available when MFA is required. To activate this setting, the
FactorConfigurationof your user poolWebAuthnConfigurationmust beMULTI_FACTOR_WITH_USER_VERIFICATION. To activate this setting, your user pool must be in the Essentials tier or higher. -
username(UsernameType) –The name of the user that you want to query or modify. The value of this parameter is typically your user's username, but it can be any of their alias attributes. If
usernameisn't an alias attribute in your user pool, this value must be thesubof a local user or the username of a user from a third-party IdP. -
user_pool_id(UserPoolIdType) –The ID of the user pool where you want to set a user's MFA preferences.
Raises:
-
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.
-
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.
-
ResourceNotFoundException–This exception is thrown when the Amazon Cognito service can't find the requested resource.
-
UserNotConfirmedException–This exception is thrown when a user isn't confirmed successfully.
-
UserNotFoundException–This exception is thrown when a user isn't found.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_cognito_identity_provider/_services/async_cognito_identity_provider.py
2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 | |