I am building an app in react-native
and using axios package
for post
request. I get the error when axios post request in react-native
android app. SSL
certificate is signed with letsencrypt.
Https
request is working with React-Native 0.47.2 but after upgrading to React-Native 0.55.0 it gives the certificate error.
Certificate is working in both desktop and mobile browsers as well as on application web portal but not working in android app.
Versions android: 8.0.0 React Native: 0.55.0
Error
"java.security.cert.CertPathValidatorException: Trust anchor for certification path not found."
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">10.0.2.2</domain><!-- Debug port -->
<domain includeSubdomains="true">abc.online</domain>
<trust-anchors>
<certificates src="@raw/abc"/>
</trust-anchors>
</domain-config>
</network-security-config>
This works for me, 10.0.2.2 is the default number for the emulator to communicate with localhost on your machine. If you are using your phone, it should be another IP address.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With