Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need help to initialize socket factory for multiple domain. #98

Open
samina-momin-aera opened this issue Feb 3, 2022 · 0 comments
Open

Comments

@samina-momin-aera
Copy link

Hi Team,

I need your help, I'm working with React Native. I'm consuming APIs from different domain. I have to integrate SSL pinning for 'xyz.com' domain and want other services still should work without SSL pinning.

Currently I'm using below code to create builder.

private static String HOSTNAME = "xyz.com";

public OkHttpClient createNewNetworkModuleClient() {
OkHttpClient.Builder client = new OkHttpClient.Builder()
.connectTimeout(0, TimeUnit.MILLISECONDS)
.readTimeout(0, TimeUnit.MILLISECONDS)
.writeTimeout(0, TimeUnit.MILLISECONDS)
.cookieJar(new ReactCookieJarContainer())
.addInterceptor(OkHttp3Helper.getPinningInterceptor())
.followRedirects(false)
.followSslRedirects(false);
.sslSocketFactory(TrustKit.getInstance().getSSLSocketFactory(HOSTNAME ),TrustKit.getInstance().getTrustManager(HOSTNAME ));
return OkHttpClientProvider.enableTls12OnPreLollipop(client).build();

Currently unable to call google services with application. Even React Native Image component not loading image with SSL pinning.

.sslSocketFactory(TrustKit.getInstance().getSSLSocketFactory(HOSTNAME ),TrustKit.getInstance().getTrustManager(HOSTNAME ));

How can we bypass other domain SSL ? Or else if we add pin for respective domain in nextwork config file, How to defined two different domain here in sslSocketFactory.

Can you please help.

Thanks!

@samina-momin-aera samina-momin-aera changed the title Need help to initialize socket factory with for multiple domain. Need help to initialize socket factory for multiple domain. Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant