0

My Ionic based app works correctly when deploying it using ionic run android on my real device. However, when I download the exact same version from Google Play, all $http requests fail:

09-15 18:59:02.901: I/chromium(22744): [INFO:CONSOLE(26799)] "Failed to log in user [...]: 
{"data":null,
    "status":-1,
    "config": {
       "method":"GET",
       "transformRequest":[null],
       "transformResponse":[null],
       "url":"https://example.com/something",
       "headers":{
          "Accept":"application/json, text/plain, */*",
          "Authorization":"Basic c2ltb2324Ghlbmlu5322Ng=="}
       },
       "statusText":""}", 
       source: file:///android_asset/www/lib/ionic/js/ionic.bundle.js (26799)

This is what I use for my request

 $http.get(config.apiUrl + "/user/").then(function (response) {
      }
      callback && callback($rootScope.authenticated, response.data);
    }, function (err) {
      $log.info("Failed to log in user [...]: " + JSON.stringify(err));
    });

The app worked for a year now, but since the last uploaded version I have this issue. I did not update ionic or anything, my build environment should not have changed at all. And it really works on the same device if I use the APK I have locally, but doesn't with the Google Play one....

schneida
  • 729
  • 3
  • 11
  • 37

1 Answers1

0

Oh my god, I finally figured this out thanks to this thread: https://stackoverflow.com/a/32030346/606513

Esentially - the production version has certificate checks enabled whereas the debug version does not. The certificate for my web server was outdated (for some reason the letsencrypt renewal was not working). Updating the certificate solved all my problems!

schneida
  • 729
  • 3
  • 11
  • 37