public async Task LastRefreshTime()
        {
            var newUserRecord = await this.userBuilder.CreateRandomUserAsync();

            // New users should not have a LastRefreshTimestamp set.
            Assert.Null(newUserRecord.UserMetaData.LastRefreshTimestamp);

            // Login to cause the LastRefreshTimestamp to be set.
            await AuthIntegrationUtils.SignInWithPasswordAsync(
                newUserRecord.Email, "password", this.fixture.TenantId);

            // Attempt to retrieve the user 3 times (with a small delay between each attempt).
            // Occassionally, this call retrieves the user data without the
            // lastLoginTime/lastRefreshTime set; possibly because it's hitting a different
            // server than the login request uses.
            UserRecord userRecord = null;

            for (int i = 0; i < 3; i++)
            {
                userRecord = await this.Auth.GetUserAsync(newUserRecord.Uid);

                if (userRecord.UserMetaData.LastRefreshTimestamp != null)
                {
                    break;
                }

                await Task.Delay(1000 *(int)Math.Pow(2, i));
            }

            // Ensure the LastRefreshTimstamp is approximately "now" (with a tollerance of 10 minutes).
            var now = DateTime.UtcNow;
            int tolleranceMinutes = 10;
            var minTime           = now.AddMinutes(-tolleranceMinutes);
            var maxTime           = now.AddMinutes(tolleranceMinutes);

            Assert.NotNull(userRecord.UserMetaData.LastRefreshTimestamp);
            Assert.InRange(
                userRecord.UserMetaData.LastRefreshTimestamp.Value,
                minTime,
                maxTime);
        }
        public async Task ImportUsersWithPassword()
        {
            var randomUser = TemporaryUserBuilder.RandomUserRecordArgs();
            var args       = new ImportUserRecordArgs()
            {
                Uid           = randomUser.Uid,
                Email         = randomUser.Email,
                DisplayName   = "Random User",
                PhotoUrl      = "https://example.com/photo.png",
                EmailVerified = true,
                PasswordSalt  = Encoding.ASCII.GetBytes("NaCl"),
                PasswordHash  = Convert.FromBase64String("V358E8LdWJXAO7muq0CufVpEOXaj8aFiC7"
                                                         + "T/rcaGieN04q/ZPJ08WhJEHGjj9lz/2TT+/86N5VjVoc5DdBhBiw=="),
                CustomClaims = new Dictionary <string, object>()
                {
                    { "admin", true },
                },
                UserProviders = new List <UserProvider>
                {
                    new UserProvider()
                    {
                        Uid         = randomUser.Uid,
                        Email       = randomUser.Email,
                        DisplayName = "John Doe",
                        PhotoUrl    = "http://example.com/123/photo.png",
                        ProviderId  = "google.com",
                    },
                    new UserProvider()
                    {
                        Uid         = "fb.uid",
                        Email       = "*****@*****.**",
                        DisplayName = "John Doe",
                        PhotoUrl    = "http://example.com/123/photo.png",
                        ProviderId  = "facebook.com",
                    },
                },
            };

            var options = new UserImportOptions()
            {
                Hash = new Scrypt()
                {
                    Key = Convert.FromBase64String("jxspr8Ki0RYycVU8zykbdLGjFQ3McFUH0uiiTvC"
                                                   + "8pVMXAn210wjLNmdZJzxUECKbm0QsEmYUSDzZvpjeJ9WmXA=="),
                    SaltSeparator = Convert.FromBase64String("Bw=="),
                    Rounds        = 8,
                    MemoryCost    = 14,
                },
            };
            var usersLst = new List <ImportUserRecordArgs>()
            {
                args
            };

            var resp = await this.Auth.ImportUsersAsync(usersLst, options);

            this.userBuilder.AddUid(randomUser.Uid);

            Assert.Equal(1, resp.SuccessCount);
            Assert.Equal(0, resp.FailureCount);

            var user = await this.Auth.GetUserAsync(randomUser.Uid);

            Assert.Equal(randomUser.Email, user.Email);
            var idToken = await AuthIntegrationUtils.SignInWithPasswordAsync(
                randomUser.Email, "password", this.fixture.TenantId);

            Assert.False(string.IsNullOrEmpty(idToken));
        }