Example #1
0
        private async Task <string> GenerateRefreshToken(Guid memberId, DateTime?expires = null)
        {
            string refreshToken = RandomStringGenerator.Generate(64);

            if (expires == null)
            {
                expires = DateTime.UtcNow.AddDays(_settings.RefreshTokenLifetimeDays);
            }

            MemberRefreshToken token = new MemberRefreshToken(Guid.Empty, memberId, expires.Value, refreshToken);
            await _memberRepository.AddRefreshToken(token);

            return(refreshToken);
        }