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
2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 | |