private async Task <LoginToken> quickGetToken(Int64 tokenId, bool allowAnon = false) { if (tokenId == LoginToken.AnonymousLoginId && allowAnon) { return(LoginTokenTasks.GetAnonmymousToken()); } var token = await LoginTokenTasks.GetLoginTokenAsync(_context, tokenId); if (token.User.Active) { return(token); } throw AutoApiError.InvalidToken(); }
public async Task <LoginToken> getToken(Int64 tokenId) { LoginToken token; if (tokenId == LoginToken.AnonymousLoginId) { token = LoginTokenTasks.GetAnonmymousToken(); } else { token = await LoginTokenTasks.GetLoginTokenAsync(_context, tokenId); } if (token == null) { throw AutoApiError.InvalidToken(); } return(token.CloneForExport()); }