'React native fetch on android against local RestAPI with self signed SSL certificate

Is there a way to ignore the self signed ssl as react native is using okHTTP3 on android under the hood and its not allowed to fetch from self signed SSL APIs, in my case its going to be always a local RestAPI and it will run on the local network. what is the workaround?



Solution 1:[1]

You can specify in your dev build that a particular host is insecure

See https://stackoverflow.com/a/61884408/1542667

https://square.github.io/okhttp/4.x/okhttp-tls/okhttp3.tls/-handshake-certificates/-builder/add-insecure-host/

Solution 2:[2]

In the end i used HTTP with clear type in the android manifest file.

android:usesCleartextTraffic="true"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yuri Schimke
Solution 2 Hak