IdentityModel/IdentityModel.OidcClient.Samples

ios authenticates fine, Android platform has the following error: Trust anchor for certification path not found.

TaylorArmstrong opened this issue · 0 comments

I have a question regarding logging in with Xamarin.Forms and the ChromeCustomTabsBrowser (Android) as well as WebAuthenticatorBrowser (Android). When trying to initiate the LoginAsync method, we receive the following erorr: "Trust anchor for certification path not found."

I have even tried to authenticate with the AppAuth android library and am receiving the same error. Due to this, we are thinking this may be an oidc server-side configuration issue, possibly with an intermediate certificate. Has anyone has run into this issue before and might be able to confirm or suggest a possible solution?

  • ios Platform works fine with no error.

Full Error:
{System.InvalidOperationException: Error loading discovery document: Error connecting to ~/.well-known/openid-configuration. java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.. ---> Javax.Net.Ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. ---> Java.Security.Cert.CertificateException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. ---> Java.Security.Cert.CertPathValidatorException: Trust anchor for certification path not found.
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00068] in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/obj/Release/JniEnvironment.g.cs:11884
at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeAbstractVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0001a] in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:47
at Javax.Net.Ssl.HttpsURLConnectionInvoker.Connect () [0x00000] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-30/mcw/Javax.Net.Ssl.HttpsURLConnection.cs:433
at Xamarin.Android.Net.AndroidClientHandler+<>c__DisplayClass44_0.b__0 () [0x0007d] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.Legacy.cs:356
at System.Threading.Tasks.Task.InnerInvoke () [0x0000f] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2476
at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319
--- End of stack trace from previous location where exception was thrown ---

at Xamarin.Android.Net.AndroidClientHandler.DoProcessRequest (System.Net.Http.HttpRequestMessage request, Java.Net.URL javaUrl, Java.Net.HttpURLConnection httpConnection, System.Threading.CancellationToken cancellationToken, Xamarin.Android.Net.AndroidClientHandler+RequestRedirectionState redirectState) [0x000e4] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.Legacy.cs:405
at Xamarin.Android.Net.AndroidClientHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00286] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Xamarin.Android.Net/AndroidClientHandler.Legacy.cs:287
at System.Net.Http.HttpClient.FinishSendAsyncBuffered (System.Threading.Tasks.Task`1[TResult] sendTask, System.Net.Http.HttpRequestMessage request, System.Threading.CancellationTokenSource cts, System.Boolean disposeCts) [0x0017e] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corefx/src/System.Net.Http/src/System/Net/Http/HttpClient.cs:506
at IdentityModel.Client.HttpClientDiscoveryExtensions.GetDiscoveryDocumentAsync (System.Net.Http.HttpMessageInvoker client, IdentityModel.Client.DiscoveryDocumentRequest request, System.Threading.CancellationToken cancellationToken) [0x00173] in D:\a\IdentityModel\IdentityModel\src\Client\Extensions\HttpClientDiscoveryExtensions.cs:77
--- End of inner exception stack trace ---
at IdentityModel.OidcClient.OidcClient.EnsureProviderInformationAsync (System.Threading.CancellationToken cancellationToken) [0x00155] in //src/OidcClient/OidcClient.cs:410
at IdentityModel.OidcClient.OidcClient.EnsureConfigurationAsync (System.Threading.CancellationToken cancellationToken) [0x00023] in /
/src/OidcClient/OidcClient.cs:374
at IdentityModel.OidcClient.OidcClient.LoginAsync (IdentityModel.OidcClient.LoginRequest request, System.Threading.CancellationToken cancellationToken) [0x00070] in /_/src/OidcClient/OidcClient.cs:73
at PrebillViewerMobile.Services.OidcIdentityService.Authenticate () [0x00048] in C:\Prebill\PrebillViewerMobile\PrebillViewerMobile\PrebillViewerMobile\Services\OidcIdentityService.cs:71 }