private async Task RefreshAuthorization() { await _authenticationClient.Authenticate(); _forceClient = new NetCoreForce.Client.ForceClient( _authenticationClient.AuthenticationClient.AccessInfo.InstanceUrl, _authenticationClient.AuthenticationClient.ApiVersion, _authenticationClient.AuthenticationClient.AccessInfo.AccessToken); _logger.LogDebug($"Salesforce Authentication Successful!"); }
/// <summary> /// Constructor for <see cref="AuthenticationClientProxy"/> /// that create an instance of <see cref="NetCoreForce.Client.ForceClient"/>. /// </summary> /// <param name="authenticationClient">Instance of <see cref="AuthenticationClientProxy"/> that creates instance of <see cref="AuthenticationClient"/>.</param> /// <param name="logger">Instance of the <see cref="ILogger{IForceClientProxy}"/>.</param> /// <param name="options">Options based on <see cref="SalesforceConfiguration"/></param> public ForceClientProxy( IAuthenticationClientProxy authenticationClient, ILogger <ForceClientProxy> logger, SalesforceConfiguration options) { _options = options ?? throw new ArgumentNullException(nameof(options)); _authenticationClient = authenticationClient ?? throw new ArgumentNullException(nameof(authenticationClient)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); // creates an instance of the forceclient register as singleton _forceClient = new NetCoreForce.Client.ForceClient( _authenticationClient.AuthenticationClient.AccessInfo.InstanceUrl, _authenticationClient.AuthenticationClient.ApiVersion, _authenticationClient.AuthenticationClient.AccessInfo.AccessToken ); // create retry authentication policy _policy = CreateAuthenticationWaitAndRetry(_options.Retry, nameof(ForceClientProxy), OnWaitAndRetry); }