コード例 #1
0
        //
        // Given an email address and confirmation code, confirm the user.
        public async Task <bool> confirmUser(string email, string code)
        {
            var provider = new AmazonCognitoIdentityProviderClient(new AnonymousAWSCredentials(), Amazon.RegionEndpoint.EUWest2);
            var userPool = new CognitoUserPool(Statics.poolID, Statics.clientID, provider);

            var user = new CognitoUser(email, Statics.clientID, userPool, provider);

            Console.WriteLine($"Adding user {email} confirmation");
            try
            {
                await user.ConfirmSignUpAsync(code, false).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return(false);
            }

            //await userPool.SignUpAsync(email, password, attributes, new Dictionary<string,string>());
            Console.WriteLine("Done confirm async.");

            return(true);
        }