Legacy Dev Forum Posts

 View Only

Sign Up

  • 1.  Proxy for C# SDK

    Posted 06-05-2025 18:05

    pierrick | 2018-11-09 08:36:53 UTC | #1

    I have tried to use a proxy to connect to PureCloud via the C# SDK but the proxy setting seems to only be available for the RestClient. This causes the PostToken to not use the proxy settings.

    Sample code:

    				Configuration.Default.ApiClient.RestClient.BaseUrl = new Uri($"https://api.{cmbEnvironment.SelectedItem.ToString()}");
    				if (!string.IsNullOrEmpty(txtProxyAddress.Text))
    				{
    					var proxyPort = Convert.ToInt32(numProxyPort.Value);
    					var myProxy = new System.Net.WebProxy(txtProxyAddress.Text, proxyPort);
    					Configuration.Default.ApiClient.RestClient.Proxy = myProxy;
    				}
    
    				// This does not use the proxy settings and fails
    				var accessTokenInfo = Configuration.Default.ApiClient.PostToken(txtClientId.Text, txtClientSecret.Text);
    				Configuration.Default.AccessToken = accessTokenInfo.AccessToken;

    What is the proper way to use proxy settings?


    tim.smith | 2018-11-09 14:52:54 UTC | #2

    Created API-3903 for this. Feel free to submit a PR to rewrite the extension method to use the API client's rest client. That code is here


    system | 2018-12-10 14:54:53 UTC | #3

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 3953