Connection refused at login callback

I’m using ASP .NET (System.Web) as my client and only accept Username-Password-Authentication with Sign ups disabled so only the users I’ll create can connect to the web app. I’m using the webAuth method which display me the basic hosted page.

I followed the quickstart guide for aspnet webapps on a brand new ASP .NET MVC projet with no authentication and it does authenticate the user but when it goes to call the login callback (http ://localhost:4987/LoginCallback.ashx?code=XXXXXXX), I get an ERR_CONNECTION_REFUSED. My redirectUrl is set in my client settings. Is it something that has to be modify in the LoginCallback.ashx ?

I downloaded the sample app for asp .net they provide though theirs does not return the code value so it triggers another type of error which didn’t help me.

**UPDATE 1 : ** The url used to access the client is reached with the click of a login button and goes somewhat like this : https://DOMAIN.auth0.com/login?client=CLIENTID&protocol=oauth2&redirect_uri=http://localhost:4987/LoginCallback.ashx&response_type=code&scope=openid%20profile&audience=https://DOMAIN.auth0.com/userinfo&auth0Client=VALUE&state=VALUE

The user would then log in using it’s credentials. I say the connection works since when I look in the dashboard, my the logins in the last 7 days increments by one and in the users I can see that his last login would be around 1 minute ago. And here is the step where I get the error.

Would it be because Auth0 forces me to add a callback url with the port 4987 while my app runs on another one ? If I switched the port in the allowed callback urls for the one my app runs on, I get an error saying that the callback url with the port 4987 is not in my allowed callback urls. If I put both, I still get the above error ( ERR_CONNECTION_REFUSED ) .

The ERR_CONNECTION_REFUSED seems to point that no one is listening at localhost:4987 for HTTP connections. I can replicate that locally as I have no application running on that port.

You say you can initiate and complete the authentication and it only fails when doing the callback; can you be more specific and update the question with the URL’s you use to access the client application.