-1

I have an app with 3 project, Data, API, and IS4.

IS4 returns ERR_CERT_AUTHORITY_INVALID on chrome, I figure this is the SSL bug that has been happening for mac for asp.net core. It works just fine when I opened on safari so I continue to try to use my front end app to request to the API resource.

However, the API resource rejects me both at postman, safari, and chrome

It gave me this:

      Content root path: /Users/src/API                  │
fail: Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[3]                                                                                        │
      Exception occurred while processing message.                                                                                                             │
      System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'System.String'.                                                        │
       ---> System.IO.IOException: IDX20804: Unable to retrieve document from: 'System.String'.                                                                │
       ---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.                                            │
       ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot│
         at System.Net.Security.SslStream.SendAuthResetSignal(ProtocolToken message, ExceptionDispatchInfo exception)                                          │
         at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean i│
sApm)                                                                                                                                                          │
         at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Boolean async, Stream stream, SslClientAuthenticationOptions sslOptions, Cancellation│
Token cancellationToken)                                                                                                                                       │
         --- End of inner exception stack trace ---                                                                                                            │
         at System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(Boolean async, Stream stream, SslClientAuthenticationOptions sslOptions, Cancellation│
Token cancellationToken)                                                                                                                                       │
         at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)                    │
         at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)     │
         at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)          │

What is that? I tried most solutions I found on google, this, this, and this. I can't get it work even after these 2 commands:

dotnet dev-certs https --clean
dotnet dev-certs https --trust

Can anyone tell me what is happening? I believe it was not like this before upgrading from .net core 3.1

Thanks

Robert Tirta
  • 2,593
  • 3
  • 18
  • 37
  • The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot. Have you tired https://learn.microsoft.com/pl-pl/aspnet/core/security/enforcing-ssl?view=aspnetcore-5.0&tabs=visual-studio#os-x---certificate-not-trusted – Tom Ash Nov 24 '20 at 10:33
  • Yeah i said that at the end of my question. I already tried that, thanks though – Robert Tirta Nov 24 '20 at 10:39
  • I know that you said about running commands, but there are steps taht you have to do before. I wonder if you checked that also. – Tom Ash Nov 24 '20 at 10:41
  • Hey yeah, I just followed that to remove it from the keychain then re-do the commands. Still does not work for me though weirdly – Robert Tirta Nov 24 '20 at 10:44
  • I would check if the cert you are using is valid in your keystore. Maybe you are missing some certs? Maybe the cert is created for specific IP or hostname and you are using it on a different host (docker etc.) – Tom Ash Nov 24 '20 at 10:47
  • no i'm not using docker, i deleted the previous cert as well already.. – Robert Tirta Nov 24 '20 at 12:38

2 Answers2

1

After following all other solution, the only one that worked for me was to completely reinstall dotnet on my mac

Follow this step to uninstall, then reinstall clean.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Robert Tirta
  • 2,593
  • 3
  • 18
  • 37
1

Dears,

Below is the description for dev env. Try following command, it worked for me.

Installing the .NET Core SDK installs the ASP.NET Core HTTPS development certificate to the local user certificate store. The certificate has been installed but is not trusted. To trust the certificate, take the one-time step to run the dotnet tool : dev-certs

dotnet dev-certs https --trust
Akif Irfan
  • 63
  • 6