コード例 #1
0
        public async Task <IXeroToken> GetAccessTokenAsync(string xeroUserId)
        {
            if (!_tokens.ContainsKey(xeroUserId))
            {
                return(null);
            }

            var token = _tokens[xeroUserId];

            token = await _xeroClient.GetCurrentValidTokenAsync(token);

            SetToken(xeroUserId, token);

            return(token);
        }
コード例 #2
0
        public async Task <IXeroToken> GetAccessTokenAsync(string xeroUserId)
        {
            var tokens = await _tokenRepository.Get(t => t.XeroUserId == xeroUserId, 0, 1);

            var tokenSaved = tokens.FirstOrDefault();

            if (tokenSaved == null)
            {
                return(null);
            }

            var token = await _xeroClient.GetCurrentValidTokenAsync((IXeroToken)tokenSaved);

            await SetToken(token);

            return(token);
        }