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); }
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); }