androidreact-nativeibm-mobilefirstmobilefirst-adapters

Ignore Certificate Error in Mobile First (React Native) (Android)


I'm currently working with React Native that needs to integrate Mobile First. I try to ping the server but it throws this error.

 java.security.cert.CertPathValidatorException: Trust anchor for
 certification path not found.

The server certificate wasn't signed by a CA, but was self signed.

I searched and found that adding the self signed cert to trust-anchor (https://developer.android.com/training/articles/security-config) should resolve the issue. Installing the certificate to the device will do the trick too.

Unfortunately, the certificate itself has issue too so I cannot make it work using the solution above.

I know the proper solution for this is to install a valid and trusted certificate on the server side but we are still in development mode. I'd like to ask if there's a way to just ignore the SSL Certificate Error?

BTW I'm using MobileFirst SDK's function, specifically WLAuthorizationManager.login() and WLAuthorizationManager.obtainAccessToken()


Solution

  • If this is your test environment, you can switch over to HTTP instead of HTTPS where certificate validation won't occur. Of course, your server will have to support it too. If this is your production environment, the only solution is to get a certificate signed by a proper CA chain.