Timeout error in AuthenticationApiClient.GetTokenAsync call

I’m trying to run the Custom login sample application. I have configured the code with the details of the Auth0 application created in my tenant. My code is running behind a proxy server and I have configured the proxy server details and have supplied the credentials in code. The call to GetTokenAsync always times out but there is always successful login in Auth0 logs every time. If I were to enter incorrect credentials, I get the incorrect credentials error message.

string auth0Domain = ConfigurationManager.AppSettings["auth0:Domain"];
                    string auth0ClientId = ConfigurationManager.AppSettings["auth0:ClientId"];
                    string auth0ClientSecret = ConfigurationManager.AppSettings["auth0:ClientSecret"];

                    var proxyHandler = new HttpClientHandler
                        Proxy = new WebProxy
                            Credentials = new NetworkCredential(proxyusername, proxypwd),
                            Address = new Uri("{Proxy URL}")

                    AuthenticationApiClient client =
                                new AuthenticationApiClient(
                                    new Uri($"https://{auth0Domain}/"), new HttpClientAuthenticationConnection(proxyHandler));
                    var result = await client.GetTokenAsync(new ResourceOwnerTokenRequest
                        ClientId = auth0ClientId,
                        ClientSecret = auth0ClientSecret,
                        Scope = "openid profile",
                        Realm = "Username-Password-Authentication", // Specify the correct name of your DB connection
                        Username = vm.EmailAddress,
                        Password = vm.Password

I have also set the security protocol to TLS 1.2 in the Startup configuration as some post suggested, but it doesn’t seem to have an impact.

        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

Here is the error message

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond {IP address}:443

Did you ever find a solution to this? I’m having the same issue currently.

Hey there @adavisson!

I would encourage you to have it created as a GitHub issue here so we can work on that directly with the tool maintainers and get their guidance.

Here’s the link to the repo:

Once you create it you can share a link to it here so we can ping them. Thank you!

As a matter of fact, I was able to fix the issue and connect with Auth0 successfully. I made the following configuration change which helped address the problem:

		<defaultProxy useDefaultCredentials="true">
			<proxy usesystemdefault="True" proxyaddress="<proxy address>" bypassonlocal="True" />
1 Like

Perfect! Thanks for sharing it with the rest of community!