Пример #1
0
        /// <summary>
        /// Получить токен авторизации
        /// </summary>
        /// <returns></returns>
        public async Task <Result <string> > GetToken(LoginDto model)
        {
            Result <string> tokenResult = await _userManagementServiceClient.GetToken(new LoginModelClientDto
            {
                Login    = model.Login,
                Password = model.Password
            });

            if (tokenResult.IsFailure)
            {
                _logger.Warning($"GetToken. Error getting authorization token. Login: {model.Login}. {tokenResult.ErrorMessage}");
                return(Result.Failure <string>(ErrorCodes.UnableToGetToken));
            }

            return(Result.Success(tokenResult.Value));
        }