public ForceClient GetApiClientWithAccessToken(SalesforceApiOptions options, string accessToken) { using AuthenticationClient auth = this.CreateAuthenticationClient(options.InstanceEndpoint); auth.AccessToken = accessToken; return(this.CreateForceClient(auth)); }
public async Task <ForceClient> GetApiClientWithRefreshToken(SalesforceApiOptions options, string refreshToken) { using AuthenticationClient auth = this.CreateAuthenticationClient(options.InstanceEndpoint); if (!string.IsNullOrEmpty(options.AuthEndpoint)) { await auth.TokenRefreshAsync(options.ConsumerKey, refreshToken, options.ConsumerSecret, options.AuthEndpoint); } else { await auth.TokenRefreshAsync(options.ConsumerKey, refreshToken, options.ConsumerSecret); } return(this.CreateForceClient(auth)); }
public async Task <ForceClient> CreateApiClient(SalesforceApiOptions options, string username, string password) { using var auth = this.CreateAuthenticationClient(options.InstanceEndpoint); if (!string.IsNullOrEmpty(options.AuthEndpoint)) { await auth.UsernamePasswordAsync(options.ConsumerKey, options.ConsumerSecret, username, password, options.AuthEndpoint); } else { await auth.UsernamePasswordAsync(options.ConsumerKey, options.ConsumerSecret, username, password); } // await auth.WebServerAsync(consumerKey, consumerSecret, "http://localhost:666/api/SalesforceOAuth/callback", "aPrx8euw8KQvhFGQXnYE6WJkKcZ.KVAtN6oBCpiZ3K3wmsqJ9jCbum47uHRsHETmVGM5OjDMAg==", "https://test.salesforce.com/services/oauth2/token"); return(this.CreateForceClient(auth)); }