Ionic Creator user auth with Ionic Cloud - Nothing happens

Hi there,

I have been trying to reproduce the Ionic Creator tutorial for user authentication with Ionic Cloud, unsuccessfully…

Even when copying source code for github.usecreator.com.

For instance, if we have a look at the signup form:

  1. I created a signup form with 3 components: email input (ng-model=“data.emaill”), password input (ng-model=“data.password”) and submit button (ng-click=“signup”)

  2. I include the Ionic Cloud and referenced the ID of my app

  3. coded the following in my signup controller

     function ($scope, $stateParams, $ionicAuth, $ionicUser, $state) {
    
     $scope.data = {
         'name': '',
         'email': '',
         'password': ''
     };
    
     $scope.error='';
    
     $scope.signup = function(){
     
         $scope.error = '';
    
         $ionicAuth.signup($scope.data).then(function() {
             // `$ionicUser` is now registered
             $ionicAuth.login('basic', $scope.data).then(function(){
                 $state.go('menu.home');
             });
         }, function(err) {
         
             var error_lookup = {
                 'required_email': 'Missing email field',
                 'required_password': 'Missing password field',
                 'conflict_email': 'A user has already signed up with that email',
                 'conflict_username': 'A user has already signed up with that username',
                 'invalid_email': 'The email did not pass validation'
             };    
     
             $scope.error = error_lookup[err.details[0]];
         });
     };}
    

When I preview and click the signup button nothing happens and no error is display (I added an error label to display the $scope.error variable).

I wanted to display the Google Inspector to see if something is happening in the background but it looks like nothing happens in the Network tab…

Any idea of what could be wrong or even how I could debug this?

Thanks a lot,

Manuel

Same for me. Having same trouble.

And I have no idea how to get it fixed :frowning:

Try using $scope.$apply(). Let us know.

I am also having the same problem when recreating the weekly workshops/tutorials. I have tried $scope.$apply() with no success.

I am not using the IonicAuth anymore but from what I understand, this is due to the fact that the promise resolution is out of the Angular digest scope.

I solved this by using $q to encapsulate the authentication.

Simplified example:

function signup = function(data) {
      var deferred = $q.defer();
      $ionicAuth.signup(data).then(function() {
        deferred.resolve();
      }).catch(function(error) {
        deferred.reject(error);
      });
      return deferred.promise;
    });

   signup($scope.data).catch(function(error) {
     $scope.error = error;
   }

Hope this will help you !

Did this issue ever get resolved? Have the exact same issue.

It doesn’t work for me. how can i solve this problem?