sign_up
async
¶
sign_up(
client_id: ClientIdType,
username: UsernameType,
*,
config_overrides: Optional[AsyncCognitoIdentityProviderClientConfig] = None,
secret_hash: Optional[SecretHashType] = None,
password: Optional[PasswordType] = None,
user_attributes: Optional[AttributeListType] = None,
validation_data: Optional[AttributeListType] = None,
analytics_metadata: Optional[AnalyticsMetadataType] = None,
user_context_data: Optional[UserContextDataType] = None,
client_metadata: Optional[ClientMetadataType] = None,
) -> SignUpResponse
Registers a user with an app client and requests a user name, password, and user attributes in the user pool.
Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints.
This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint. Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.
If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.
You might receive a LimitExceeded exception in response to this request if you have exceeded a rate quota for email or SMS messages, and if your user pool automatically verifies email addresses or phone numbers. When you get this exception in the response, the user is successfully created and is in an UNCONFIRMED state.
Parameters:
-
client_id(ClientIdType) –The ID of the app client where the user wants to sign up.
-
secret_hash(Optional[SecretHashType], default:None) –A keyed-hash message authentication code (HMAC) calculated using the secret key of a user pool client and username plus the client ID in the message. For more information about
SecretHash, see Computing secret hash values. -
username(UsernameType) –The username of the user that you want to sign up. The value of this parameter is typically a username, but can be any alias attribute in your user pool.
-
password(Optional[PasswordType], default:None) –The user's proposed password. The password must comply with the password requirements of your user pool.
Users can sign up without a password when your user pool supports passwordless sign-in with email or SMS OTPs. To create a user with no password, omit this parameter or submit a blank value. You can only create a passwordless user when passwordless sign-in is available.
-
user_attributes(Optional[AttributeListType], default:None) –An array of name-value pairs representing user attributes.
For custom attributes, include a
custom:prefix in the attribute name, for examplecustom:department. -
validation_data(Optional[AttributeListType], default:None) –Temporary user attributes that contribute to the outcomes of your pre sign-up Lambda trigger. This set of key-value pairs are for custom validation of information that you collect from your users but don't need to retain.
Your Lambda function can analyze this additional data and act on it. Your function can automatically confirm and verify select users or perform external API operations like logging user attributes and validation data to Amazon CloudWatch Logs.
For more information about the pre sign-up Lambda trigger, see Pre sign-up Lambda trigger.
-
analytics_metadata(Optional[AnalyticsMetadataType], default:None) –Information that supports analytics outcomes with Amazon Pinpoint, including the user's endpoint ID. The endpoint ID is a destination for Amazon Pinpoint push notifications, for example a device identifier, email address, or phone number.
-
user_context_data(Optional[UserContextDataType], default:None) –Contextual data about your user session like the device fingerprint, IP address, or location. Amazon Cognito threat protection evaluates the risk of an authentication event based on the context that your app generates and passes to Amazon Cognito when it makes API requests.
For more information, see Collecting data for threat protection in applications.
-
client_metadata(Optional[ClientMetadataType], default:None) –A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers. You create custom workflows by assigning Lambda functions to user pool triggers.
When Amazon Cognito invokes any of these functions, it passes a JSON payload, which the function receives as input. This payload contains a
clientMetadataattribute that provides the data that you assigned to the ClientMetadata parameter in your request. In your function code, you can process theclientMetadatavalue to enhance your workflow for your specific needs.To review the Lambda trigger types that Amazon Cognito invokes at runtime with API requests, see Connecting API actions to Lambda triggers in the Amazon Cognito Developer Guide.
When you use the
ClientMetadataparameter, note that Amazon Cognito won't do the following:-
Store the
ClientMetadatavalue. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, theClientMetadataparameter serves no purpose. -
Validate the
ClientMetadatavalue. -
Encrypt the
ClientMetadatavalue. Don't send sensitive information in this parameter.
-
Raises:
-
CodeDeliveryFailureException–This exception is thrown when a verification code fails to deliver successfully.
-
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.
-
InvalidEmailRoleAccessPolicyException–This exception is thrown when Amazon Cognito isn't allowed to use your email identity. HTTP status code: 400.
-
InvalidLambdaResponseException–This exception is thrown when Amazon Cognito encounters an invalid Lambda response.
-
InvalidParameterException–This exception is thrown when the Amazon Cognito service encounters an invalid parameter.
-
InvalidPasswordException–This exception is thrown when Amazon Cognito encounters an invalid password.
-
InvalidSmsRoleAccessPolicyException–This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.
-
InvalidSmsRoleTrustRelationshipException–This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust
cognito-idp.amazonaws.comor the external ID provided in the role does not match what is provided in the SMS configuration for the user pool. -
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.
-
ResourceNotFoundException–This exception is thrown when the Amazon Cognito service can't find the requested resource.
-
TooManyRequestsException–This exception is thrown when the user has made too many requests for a given operation.
-
UnexpectedLambdaException–This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.
-
UserLambdaValidationException–This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.
-
UsernameExistsException–This exception is thrown when Amazon Cognito encounters a user name that already exists in the user pool.
-
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
9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 | |