Пример #1
0
        public async Task <string> GetRequestTokenAsync(string userName)
        {
            var userSession = _userSessionRepository.GetUserSession(userName);

            if (userSession != null && userSession.IsAuthorized)
            {
                return(userSession.RequestToken);
            }

            if (userSession == null)
            {
                userSession = await _userSessionRepository.CreateUserSessionAsync(userName);
            }

            var token = await _pocketService.GetRequestTokenAsync();

            userSession.RequestToken = token;

            await _userSessionRepository.UpdateUserSessionAsync(userSession);

            return(token);
        }