Amazon.CognitoIdentityProvider.AmazonCognitoIdentityProviderClient.SignUpAsync C# (CSharp) Method

SignUpAsync() public method

Initiates the asynchronous execution of the SignUp operation.
public SignUpAsync ( SignUpRequest request, System cancellationToken = default(CancellationToken) ) : Task
request Amazon.CognitoIdentityProvider.Model.SignUpRequest Container for the necessary parameters to execute the SignUp operation.
cancellationToken System /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. ///
return Task
        public Task<SignUpResponse> SignUpAsync(SignUpRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SignUpRequestMarshaller();
            var unmarshaller = SignUpResponseUnmarshaller.Instance;

            return InvokeAsync<SignUpRequest,SignUpResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }

Usage Example

Exemplo n.º 1
0
    internal async Task <bool> SignUpUser(string username, string password, string email, string phonenumber)
    {
        Amazon.CognitoIdentityProvider.AmazonCognitoIdentityProviderClient provider =
            new Amazon.CognitoIdentityProvider.AmazonCognitoIdentityProviderClient(new Amazon.Runtime.AnonymousAWSCredentials());

        SignUpRequest signUpRequest = new SignUpRequest();

        signUpRequest.ClientId = CLIENTAPP_ID;
        signUpRequest.Username = username;
        signUpRequest.Password = password;


        AttributeType attributeType = new AttributeType();

        attributeType.Name  = "phone_number";
        attributeType.Value = phonenumber;
        signUpRequest.UserAttributes.Add(attributeType);

        AttributeType attributeType1 = new AttributeType();

        attributeType1.Name  = "email";
        attributeType1.Value = email;
        signUpRequest.UserAttributes.Add(attributeType1);


        try
        {
            SignUpResponse result = await provider.SignUpAsync(signUpRequest);
        }
        catch (Exception e)
        {
            Console.WriteLine(e);
            return(false);
        }
        return(true);
    }
AmazonCognitoIdentityProviderClient