public async Task <LoginResult> RefreshToken() { try { using (var da = new CredentialDataAccess(_conStr)) { var savedCred = (await da.GetByParent <Workflow, Connector>(_workflowId, _connectorId)).FirstOrDefault(); if (savedCred != null) { LoginRequest data = new LoginRequest { Username = savedCred.UserName, Password = savedCred.Password, SecurityToken = savedCred.SecretToken }; SalesforceClient_Authentication client = new SalesforceClient_Authentication(); var result = await client.LoginAsync(data); return(result); } } return(null); } catch (Exception ex) { return(null); } }
public async Task <LoginResult> Authenticate(LoginRequest data) { SalesforceClient_Authentication client = new SalesforceClient_Authentication(); var result = await client.LoginAsync(data); if (result != null) { await SaveCredentials(data, _workflowId, _connectorId); return(result); } return(result); }