silkimen / cordova-plugin-advanced-http

Cordova / Phonegap plugin for communicating with HTTP servers. Allows for SSL pinning!
MIT License
400 stars 321 forks source link

Why am I not able to inspect network activity? #430

Closed Keyurhardas closed 3 years ago

Keyurhardas commented 3 years ago

I am using this plugin in my Ionic 3 app for SSL pinning and I am using this through Plain Cordova approach. This is my code which enabled ssl pinning and sends a GET request. I am getting the response but I am not able to view the network activity in the Chrome developer tools> Network tab.

How can I view the network activity in my app with this plugin installed.

 SignInGetCall = (methodName: any, data: any) => {
    return new Promise((resolve, reject) => {
      if (this.networkProvider.isNetworkAvailable()) {
        var Headers = {
          SessionId: "",
          PersonId: "",
          LoginUserId: "",
        };
        cordova.plugin.http.setServerTrustMode(
          "pinned",
          () => {
            console.log("success! certificate pinned");
            cordova.plugin.http.get(
              this._global.MobileServiceURL + "/api/" + methodName,
              data,
              Headers,
              (response) => {
                try {
                  response.data = JSON.parse(response.data);
                  resolve(response.data);
                  console.log(response);
                } catch (e) {
                  console.error("JSON parsing error");
                }
              },
              (error) => {
                reject(error);
                console.error(error.error);
              }
            );
          },
          function () {
            console.log("error :(");
          }
        );
      } else {
        this.commonProvider.presentToast("No Internet Available");
      }
    });
  };
aghilesh commented 3 years ago

@Keyurhardas this plugin uses native library to make network calls, which mean, it's not Ajax calls we do usually for a Cordova App which is handled by WebView. Only WebView originated calls are logged to Chrome Devloper tool - network tab.

You will have to depend on native debugging tools on Android Studio/Xcode to see those calls.