# Timeout error in AuthenticationApiClient.GetTokenAsync call

**URL:** <https://community.auth0.com/t/timeout-error-in-authenticationapiclient-gettokenasync-call/68303>\
**Category:** Get Help\
**Tags:** timeout-error\
**Created:** [August 20, 2021, 2:42pm UTC](https://community.auth0.com/t/timeout-error-in-authenticationapiclient-gettokenasync-call/68303 "2021-08-20T14:42:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![siddharth.a](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/siddharth.a/32/12822_2.png) [@siddharth.a](https://community.auth0.com/u/siddharth.a)\
**Post date:** [August 20, 2021, 2:42pm UTC](https://community.auth0.com/t/timeout-error-in-authenticationapiclient-gettokenasync-call/68303/1 "2021-08-20T14:42:32Z")

</div>

Hi,  
I’m trying to run the [Custom login sample application](https://github.com/auth0-samples/auth0-aspnet-owin-mvc-samples/tree/master/Samples/custom-login). 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.

```auto
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

---

<div class="post-metadata">

**Author:** ![adavisson](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/adavisson/32/12951_2.png) [@adavisson](https://community.auth0.com/u/adavisson)\
**Post date:** [October 17, 2021, 8:11pm UTC](https://community.auth0.com/t/timeout-error-in-authenticationapiclient-gettokenasync-call/68303/2 "2021-10-17T20:11:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [October 18, 2021, 9:24am UTC](https://community.auth0.com/t/timeout-error-in-authenticationapiclient-gettokenasync-call/68303/3 "2021-10-18T09:24:05Z")

</div>

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:

> **[GitHub - auth0-samples/auth0-aspnet-owin-mvc-samples: Quickstart and samples...](https://github.com/auth0-samples/auth0-aspnet-owin-mvc-samples)**
>
> Quickstart and samples for ASP.NET (OWIN) MVC. Contribute to auth0-samples/auth0-aspnet-owin-mvc-samples development by creating an account on GitHub.

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

---

<div class="post-metadata">

**Author:** ![siddharth.a](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/siddharth.a/32/12822_2.png) [@siddharth.a](https://community.auth0.com/u/siddharth.a)\
**Post date:** [October 20, 2021, 9:13am UTC](https://community.auth0.com/t/timeout-error-in-authenticationapiclient-gettokenasync-call/68303/4 "2021-10-20T09:13:54Z")

</div>

Hi,  
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:

```auto
<system.net>
		<defaultProxy useDefaultCredentials="true">
			<proxy usesystemdefault="True" proxyaddress="<proxy address>" bypassonlocal="True" />
		</defaultProxy>
	</system.net>

```

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [October 20, 2021, 10:33am UTC](https://community.auth0.com/t/timeout-error-in-authenticationapiclient-gettokenasync-call/68303/5 "2021-10-20T10:33:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [October 28, 2021, 12:35pm UTC](https://community.auth0.com/t/timeout-error-in-authenticationapiclient-gettokenasync-call/68303/6 "2021-10-28T12:35:37Z")

</div>


