React Native Support
See original GitHub issueHey, We have an android app with React Native code. React Native allow to override the default ok HTTP client for ALL network request from React Native with the following code:
OkHttpClient client =
new OkHttpClient().newBuilder()
.sslSocketFactory(trustKit.getSSLSocketFactory("www.mycompanydomain.com"),
trustKit.getTrustManager("www.mycompanydomain.com"))
.connectTimeout(0, TimeUnit.MILLISECONDS)
.readTimeout(0, TimeUnit.MILLISECONDS)
.writeTimeout(0, TimeUnit.MILLISECONDS)
.cookieJar(new ReactCookieJarContainer())
.build();
OkHttpClientProvider.replaceOkHttpClient(client);
This work perfectly well, excpet for the fact that it will block all the request to API that are not belonging to my company - for example, firebase - because it will try to pin them with our domain configuration. To solve this, we can use an approach similar to what CWAC did:
- Add a method to
PinningTrustManager
that allow changing the domain configuration - Use the same code above to add TrustKit
PinningTrustManager
to React Native client - Add an interceptor to the client used by React Native, and change the host configuration before each request
Or we can try another approach, I am pretty open to ideas - for example, try to implement pinning in network interceptor - I will try to see if that possible. Do you encounter similar problems? What will you recommend? Thanks!
Issue Analytics
- State:
- Created 7 years ago
- Comments:24 (20 by maintainers)
Top Results From Across the Web
Where to get help - React Native
Where to get help. If you need help with your React Native ...
Read more >Where To Get Support - React
Where To Get Support. React has a community of millions of developers. On this page we've listed some React-related communities that you can...
Read more >React Native - Wikipedia
React Native is an open-source UI software framework created by Meta Platforms, Inc. It is used to develop applications for Android, Android TV,...
Read more >React Native Support - Flipper
React Native Support ... Meta's React Native and Developer Tooling teams work in close collaboration to ensure Flipper offers top-notch out-of-the-box value for ......
Read more >React Native Experts to Help, Mentor, Review Code & More
Find a freelance React Native expert for help with reviewing code, mentorship, tutoring, and other React Native help you might need.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Finally, I’ve used the regular OkHttp
CertificatePinner
. It is playing pretty well with React Native, and there is a good documentation on how to integrate it with ReactNative. I did that with a small change - I read the pinning certificates from TrustKit config, which has 2 advantages:I posted a sample code in a gist, it was pretty easy to set this up.
Thanks for letting us know. I will check it out!