public async Task Can_signup_user_and_change_password()
        {
            // Arrange
            var authenticationApiClient = new AuthenticationApiClient(new Uri(GetVariable("AUTH0_AUTHENTICATION_API_URL")));

            // Sign up the user
            var signupUserRequest = new SignupUserRequest
            {
                ClientId   = GetVariable("AUTH0_CLIENT_ID"),
                Connection = connection.Name,
                Email      = $"{Guid.NewGuid().ToString("N")}@nonexistingdomain.aaa",
                Password   = "******"
            };
            var signupUserResponse = await authenticationApiClient.SignupUserAsync(signupUserRequest);

            signupUserResponse.Should().NotBeNull();
            signupUserResponse.Id.Should().NotBeNull();
            signupUserResponse.EmailVerified.Should().BeFalse();
            signupUserResponse.Email.Should().Be(signupUserRequest.Email);

            // Change the user's Email address
            var changePasswordRequest = new ChangePasswordRequest
            {
                ClientId   = signupUserRequest.ClientId,
                Connection = signupUserRequest.Connection,
                Email      = signupUserRequest.Email,
                Password   = "******"
            };
            string changePasswordResponse = await authenticationApiClient.ChangePasswordAsync(changePasswordRequest);

            changePasswordResponse.Should().Be("\"We've just sent you an email to reset your password.\"");
        }
        public async Task Can_signup_user_and_change_password()
        {
            // Arrange
            var authenticationApiClient = new AuthenticationApiClient(new Uri(GetVariable("AUTH0_AUTHENTICATION_API_URL")));

            // Sign up the user
            var signupUserRequest = new SignupUserRequest
            {
                ClientId = clientId,
                Connection = connection.Name,
                Email = $"{Guid.NewGuid().ToString("N")}@nonexistingdomain.aaa",
                Password = "******"
            };
            var signupUserResponse = await authenticationApiClient.SignupUserAsync(signupUserRequest);
            signupUserResponse.Should().NotBeNull();
            signupUserResponse.Email.Should().Be(signupUserRequest.Email);

            // Change the user's Email address
            var changePasswordRequest = new ChangePasswordRequest
            {
                ClientId = signupUserRequest.ClientId,
                Connection = signupUserRequest.Connection,
                Email = signupUserRequest.Email,
                Password = "******"
            };
            string changePasswordResponse = await authenticationApiClient.ChangePasswordAsync(changePasswordRequest);
            changePasswordResponse.Should().Be("\"We've just sent you an Email to reset your password.\"");
        }
Beispiel #3
0
        public async Task Can_signup_user_and_change_password()
        {
            // Arrange
            var authenticationApiClient =
                new AuthenticationApiClient(GetVariable("AUTH0_AUTHENTICATION_API_URL"));

            // Sign up the user
            var signupUserRequest = new SignupUserRequest
            {
                ClientId     = GetVariable("AUTH0_CLIENT_ID"),
                Connection   = _connection.Name,
                Email        = $"{Guid.NewGuid():N}@nonexistingdomain.aaa",
                Password     = Password,
                UserMetadata = new
                {
                    a = "1",
                    b = "two"
                }
            };
            var signupUserResponse = await authenticationApiClient.SignupUserAsync(signupUserRequest);

            signupUserResponse.Should().NotBeNull();
            signupUserResponse.Id.Should().NotBeNull();
            signupUserResponse.EmailVerified.Should().BeFalse();
            signupUserResponse.Email.Should().Be(signupUserRequest.Email);

            // Change the user's Email address
            var changePasswordRequest = new ChangePasswordRequest
            {
                ClientId   = signupUserRequest.ClientId,
                Connection = signupUserRequest.Connection,
                Email      = signupUserRequest.Email,
                Password   = Password2
            };
            Func <Task> changePasswordFunc = async() => await authenticationApiClient.ChangePasswordAsync(changePasswordRequest);

            changePasswordFunc.Should().Throw <ErrorApiException>().And.ApiError.Error.Should().Be("password is not allowed");
        }