When initializing Parse on Android I can successfully connect to the analysis server when:
1) I do not provide the server URL, or
2) I set the server URL to the Parse server.
Since we intend to ultimately transfer our data from Parse to another host, we would like to connect to a different server URL. However, when I try to specify a different server URL ( https://api.ourhostname.com/1/ ) that redirects (serves as a proxy) to the Parse server, the application cannot fully connect to the server. When implementing an iOS project, this server URL works fine. However, when they are implemented on the Android equivalent:
Parse.initialize(new Parse.Configuration.Builder(this) .applicationId(APP_ID) .clientKey(CLIENT_KEY) .server("https://api.ourhostname.com/1/") .build() );
I get input / output failure:
05-24 21:46:55.319 7140-7140/com.ourapp W/System.err: com.parse.ParseRequest$ParseRequestException: i/o failure 05-24 21:46:55.324 7140-7140/com.ourapp W/System.err: at com.parse.ParseRequest.newTemporaryException(ParseRequest.java:290) 05-24 21:46:55.324 7140-7140/com.ourapp W/System.err: at com.parse.ParseRequest$2.then(ParseRequest.java:145) 05-24 21:46:55.324 7140-7140/com.ourapp W/System.err: at com.parse.ParseRequest$2.then(ParseRequest.java:139) 05-24 21:46:55.324 7140-7140/com.ourapp W/System.err: at bolts.Task$15.run(Task.java:917) 05-24 21:46:55.324 7140-7140/com.ourapp W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 05-24 21:46:55.324 7140-7140/com.ourapp W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 05-24 21:46:55.324 7140-7140/com.ourapp W/System.err: at java.lang.Thread.run(Thread.java:818) 05-24 21:46:55.324 7140-7140/com.ourapp W/System.err: Caused by: javax.net.ssl.SSLPeerUnverifiedException: Cannot verify hostname: api.ourhostname.com 05-24 21:46:55.329 7140-7140/com.ourapp W/System.err: at android.net.SSLCertificateSocketFactory.verifyHostname(SSLCertificateSocketFactory.java:242) 05-24 21:46:55.329 7140-7140/com.ourapp W/System.err: at android.net.SSLCertificateSocketFactory.createSocket(SSLCertificateSocketFactory.java:486) 05-24 21:46:55.329 7140-7140/com.ourapp W/System.err: at com.android.okhttp.Connection.upgradeToTls(Connection.java:1226) 05-24 21:46:55.329 7140-7140/com.ourapp W/System.err: at com.android.okhttp.Connection.connect(Connection.java:1183) ...
From a web browser, I can visit our custom server URL, which is reliable and valid from a browser, which means that it is not signed by itself.
Has anyone else encountered this problem from their Android project and any suggestions on how to successfully get the Parse SDK to connect to the serverβs custom URL?
UPDATE: We were able to solve this problem through:
1) Adding this solution on the Android side.
2) Configuring how our user server maintains its public keys (which is especially important so that Marshmallow can connect to the server).
eimie source share