{"action":"created","issue":{"url":"https://api.github.com/repos/datatheorem/TrustKit-Android/issues/6","repository_url":"https://api.github.com/repos/datatheorem/TrustKit-Android","labels_url":"https://api.github.com/repos/datatheorem/TrustKit-Android/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/datatheorem/TrustKit-Android/issues/6/comments","events_url":"https://api.github.com/repos/datatheorem/TrustKit-Android/issues/6/events","html_url":"https://github.com/datatheorem/TrustKit-Android/issues/6","id":201883419,"number":6,"title":"React Native Support","user":{"login":"omerlh","id":6730584,"avatar_url":"https://avatars.githubusercontent.com/u/6730584?v=3","gravatar_id":"","url":"https://api.github.com/users/omerlh","html_url":"https://github.com/omerlh","followers_url":"https://api.github.com/users/omerlh/followers","following_url":"https://api.github.com/users/omerlh/following{/other_user}","gists_url":"https://api.github.com/users/omerlh/gists{/gist_id}","starred_url":"https://api.github.com/users/omerlh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omerlh/subscriptions","organizations_url":"https://api.github.com/users/omerlh/orgs","repos_url":"https://api.github.com/users/omerlh/repos","events_url":"https://api.github.com/users/omerlh/events{/privacy}","received_events_url":"https://api.github.com/users/omerlh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":12,"created_at":"2017-01-19T14:59:21Z","updated_at":"2017-01-26T06:33:26Z","closed_at":null,"body":"Hey,\r\nWe 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:\r\n```java\r\n        OkHttpClient client =\r\n                    new OkHttpClient().newBuilder()\r\n                            .sslSocketFactory(trustKit.getSSLSocketFactory(\"www.mycompanydomain.com\"),\r\n                                    trustKit.getTrustManager(\"www.mycompanydomain.com\"))\r\n                            .connectTimeout(0, TimeUnit.MILLISECONDS)\r\n                            .readTimeout(0, TimeUnit.MILLISECONDS)\r\n                            .writeTimeout(0, TimeUnit.MILLISECONDS)\r\n                            .cookieJar(new ReactCookieJarContainer())\r\n                            .build();\r\n            OkHttpClientProvider.replaceOkHttpClient(client);\r\n````\r\nThis 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. \r\nTo solve this, we can use an approach similar to what CWAC [did](https://github.com/commonsguy/cwac-netsecurity/blob/master/netsecurity/src/main/java/com/commonsware/cwac/netsecurity/OkHttp3Integrator.java):\r\n - Add a method to `PinningTrustManager` that allow changing the domain configuration\r\n - Use the same code above to add TrustKit `PinningTrustManager` to React Native client\r\n - Add an interceptor to the client used by React Native, and change the host configuration before each request\r\n\r\nOr 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.\r\nDo you encounter similar problems? What will you recommend?\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/datatheorem/TrustKit-Android/issues/comments/275317452","html_url":"https://github.com/datatheorem/TrustKit-Android/issues/6#issuecomment-275317452","issue_url":"https://api.github.com/repos/datatheorem/TrustKit-Android/issues/6","id":275317452,"user":{"login":"omerlh","id":6730584,"avatar_url":"https://avatars.githubusercontent.com/u/6730584?v=3","gravatar_id":"","url":"https://api.github.com/users/omerlh","html_url":"https://github.com/omerlh","followers_url":"https://api.github.com/users/omerlh/followers","following_url":"https://api.github.com/users/omerlh/following{/other_user}","gists_url":"https://api.github.com/users/omerlh/gists{/gist_id}","starred_url":"https://api.github.com/users/omerlh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omerlh/subscriptions","organizations_url":"https://api.github.com/users/omerlh/orgs","repos_url":"https://api.github.com/users/omerlh/repos","events_url":"https://api.github.com/users/omerlh/events{/privacy}","received_events_url":"https://api.github.com/users/omerlh/received_events","type":"User","site_admin":false},"created_at":"2017-01-26T06:33:26Z","updated_at":"2017-01-26T06:33:26Z","body":"I think @commonsguy solution still has some issues, as the interceptor get called after the handshake - meaning, after the `TrustManager` get called. Unless I am missing something here..."}}
{"actor":{"display_login":"omerlh"}}