0
votes

I am new to NativeScript, so I need a hand with the bypass for both iOS and Android. I tried looking on google, but I have exhausted myself trying to find a solution that would suffice for Angular2+.

I have a wildcard SSL certificate from GoDaddy, so I can't use nativescript-https (https://github.com/gethuman/nativescript-https/issues/14 per their github issue).

A real example, where I can read the code and understand where everything takes place would be great, I mean, I tried look into https://discourse.nativescript.org/t/how-to-ignore-invalid-ssl-certificate-in-nativescript/1924, but none of this make sense to me since I don't know where to start with the code when using this example.

EDIT: I tried using nativescript-https disableSSLPining, no success. On my app.module.ts

import * as application from 'application';
import * as platform from 'platform';
import * as HTTPS from 'nativescript-https';

var disabledSSLError = () => {
    if(platform.isAndroid){
        application.android.startActivity = () => {
            HTTPS.disableSSLPinning();
        }
    }
};

disabledSSLError();

However, when I send a POST

    "message": "Http failure response for (unknown url): 0 Unknown Error",
JS:   "error": {
JS:     "originalStack": "Error: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.\n    at new ZoneAwareError (file:///data/data/org.nativescript.myapp/files/app/tns_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:1298:33)\n    at onRequestComplete (file:///data/data/org.nativescript.myapp/files/app/tns_modules/tns-core-modules/http/http-request/http-request.js:45:34)\n    at Object.onComplete (file:///data/data/org.nativescript.myapp/files/app/tns_modules/tns-core-modules/http/http-request/http-request.js:37:13)",
1

1 Answers

0
votes

You can use https. I think that you have misunderstood this issue. This issue just syays that if you are using pinning, then you can't use wildcard https (but you don't need to use it).

SSL pinning adds an extra layer of security, but if you are just starting out, you won't need it. ref

Just continue with standard https requests using the HttpClient library and you will be fine.