Ionic $ionicUser service problem

Hi everyone

I’m using Ionic $ionicUser service to identify a new user in order to use push notifications, track analytics etc.
In browser everything works perfect, so new user gets identify, and I’m able to see it on https://apps.ionic.io/app/MY_APP_ID/users/list page.

However, when I install the app on android device $ionicUser service is not able to identify the user and http request ( which is performed when the $ionicUser.identify(user) gets executed) returns 404.
Request payload looks good, the same format as in browser, just with different data.

Here’s my code:

function identifyUser () {
$log.info(‘Ionic User: Identifying with Ionic User service’);

  var user = $ionicUser.get();
  if(!user.user_id) {
    // Set your user_id here, or generate a random one.
    user.user_id = $ionicUser.generateGUID();
  };

  $log.info('User object: ', user);

  // Add some metadata to your user object.
  angular.extend(user, {
    name: 'Ionitron',
    bio: 'I come from planet Ion'
  });

  // Identify your user with the Ionic User Service
  $ionicUser.identify(user).then(function(){
    $log.info('Identified user ' + user.name + '\n ID ' + user.user_id);
    alert('Identified user ' + user.name + '\n ID ' + user.user_id);
  }, function(error) {
    $log.info(error);
  });
};

Any idea?

I figured it out.

I was missing cordova whitelist plugin which blocks/allows http requests (inter alia) from your app.
After downloading the plugin I had to add “” tag in config.xml file to allow all http requests from the app.