1

I am trying to connect to Azure Active Directory based on this article: Azure

I am running an ASP.NET MVC application and when I run the application connecting to azure active directory, my username and password is accepted, but then after that, I get an error showing "ERR_SSL_PROTOCOL_ERROR" .

This is my sigin code:

public void SignIn()
{
    if (!Request.IsAuthenticated)
    {
        HttpContext.GetOwinContext().Authentication.Challenge(
                    new AuthenticationProperties { RedirectUri = "/" },
                    OpenIdConnectAuthenticationDefaults.AuthenticationType); 
            }
    }
}

This is my configuration in the web.config file:

<appSettings>
    <add key="ClientId" value="XXXXXXXXX" />
    <add key="Tenant" value="XXXXXXXXXXXXXXXX" />
    <add key="Authority" value="https://login.microsoftonline.com/{0}/v2.0" />
    <add key="redirectUri" value="https://localhost:44347/login/oauth2/code/" />
</appSettings>

My application is running on port # 44368

https://localhost:44368/

This is the screen shot:

enter image description here

My applicationhost.config file binding information is like this:

<bindings>
    <binding protocol="https" bindingInformation="*:44368:localhost" />
    <binding protocol="http" bindingInformation="*:53016:localhost" />
</bindings>

I haven't changed any default settings that are created by the application. I didn't change the applicationhost.config file or the port number of the application. My redirectURI in the azure portal is 44347. Do I need to change anything in the applicationhost.config file or application port # in order to get rid of ERR_SSL_PROTOCOL_ERROR. My network team gave me two URL's that are configured in azure portal. Should I just use http instead of https:

http://localhost:44347/login/oauth2/code/
https://localhost:44347/login/oauth2/code/

Any help will be greatly appreciated.

Anjali
  • 2,540
  • 7
  • 37
  • 77
  • You're application is running on localhost with a self signed certificate installed on your local computer. Azure knows nothing about this certificate when it does redirect to your web site (secured with HTTPS). You can probably upload the public key of the certificate to your Azure application so that Azure can trust it, or you have to disable https when working locally. – Hazrelle Nov 16 '21 at 18:49
  • I am putting the Tenant and Client ID that is specified in the azure portal. wouldn't that be enough? – Anjali Nov 16 '21 at 20:40
  • My net work team gave me two URL's . should I just use http one: http://localhost:44347/login/oauth2/code/ https://localhost:44347/login/oauth2/code/ – Anjali Nov 16 '21 at 20:52
  • Hi @Anjali , try with Clearing the Cache Memory and Cookies in Chrome and refer this SO Thread: https://stackoverflow.com/questions/60558382/err-ssl-protocol-error-for-localhost-from-visual-studio-debug – ShrutiJoshi-MT Nov 17 '21 at 06:21
  • You should try with the `http` one to test if this is working properly. – Hazrelle Nov 17 '21 at 11:12
  • Is your issue resloved? – ShrutiJoshi-MT Nov 22 '21 at 09:15
  • Yes, it is. Sorry, could not try your solution earlier because I was out of town. – Anjali Dec 03 '21 at 16:29

0 Answers0