Invalid parameter value for origin missing authority file //


#1

Im trying to setup Google login. It works fine on ionic serve --lab but throws this error from the Android device.

Any ideas?

// Google Plus Login
$scope.gplusLogin = function () {

  var myParams = {

    // Replace client id with yours
    'clientid': 'XXXXXX0110880-1og8p3pjr817b2aua2nphv849kjecv5i.apps.googleusercontent.com',
    'cookiepolicy': 'single_host_origin',
    'callback': loginCallback,
    'approvalprompt': 'force',
    'scope': 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/plus.profile.emails.read'

  };

  gapi.auth.signIn(myParams);

  function loginCallback(result) {

    if (result['status']['signed_in']) {
      var request = gapi.client.plus.people.get({'userId': 'me'});
      request.execute(function (resp) {
        console.log('Google+ Login RESPONSE: ' + angular.toJson(resp));
        var userEmail;
        if (resp['emails']) {
          for (var i = 0; i < resp['emails'].length; i++) {
            if (resp['emails'][i]['type'] == 'account') {
              userEmail = resp['emails'][i]['value'];
            }
          }
        }
        // store data to DB
        var user = {};
        user.name = resp.displayName;
        user.email = userEmail;
        user.provider = 'google';
        if (resp.gender) {
          resp.gender.toString().toLowerCase() === 'male' ? user.gender = 'M' : user.gender = 'F';
        } else {
          user.gender = '';
        }
        user.profilePic = resp.image.url;
        $cookieStore.put('userInfo', user);
        $scope.modal.hide();
        $window.location.reload();
      });
    }
  }
};
// END Google Plus Login