2016-11-03 4 views
0

Ich habe diesen Fehler, warum versuchen, in meiner Cordova/Ionic App anmelden.Cordova-Authentifizierung

Cannot read property 'error_description' of undefined 
TypeError: Cannot read property 'error_description' of undefined 
at http://localhost:8000/js/services/Authentication.js:39:32 
at processQueue (http://localhost:8000/lib/ionic/js/ionic.bundle.js:21888:27) 
at http://localhost:8000/lib/ionic/js/ionic.bundle.js:21904:27 
at Scope.$eval (http://localhost:8000/lib/ionic/js/ionic.bundle.js:23100:28) 
at Scope.$digest (http://localhost:8000/lib/ionic/js/ionic.bundle.js:22916:31) 
at ChildScope.$apply (http://localhost:8000/lib/ionic/js/ionic.bundle.js:23205:24) 
at HTMLFormElement.<anonymous> (http://localhost:8000/lib/ionic/js/ionic.bundle.js:30139:23) 
at HTMLFormElement.dispatch (http://localhost:8000/lib/jquery/dist/jquery.js:4430:9) 
at HTMLFormElement.elemData.handle (http://localhost:8000/lib/jquery/dist/jquery.js:4116:28) 
at triggerMouseEvent (http://localhost:8000/lib/ionic/js/ionic.bundle.js:2863:7) 

ich wissen muss, hat mein Login/Pass falsch sind, oder einfach nur meine App nicht

Authentifizierung bezogene Code

  doLogin:   function (username, password) { 
return ServerAPI.logIn({}, {Username: username, Password: password, Version: AppConstants.Build, grant_type: "password"}).$promise 
     .then(function (response) { 
     if (!response.error) { 
      authService.loginCancelled({}); 
      currentUser.isAuthenticated = !response.error; 
      currentUser.data = response; 
      currentUser.data.UserId = response.currentUserId; 
      currentUser.data.UserName = username; 
      currentUser.UserId = response.currentUserId; 
      currentUser.lastloggedinTimestamp = (new Date()).getTime(); 
      // Saves session data into database so it can be accessed after app reopened 
      Database.insertInto('Session', currentUser.UserId, currentUser, {}); 
      // Saves the session data into a cookie so the request interceptor can access it 
      Session.put('emInspectionUser', currentUser); 
      authService.loginConfirmed(currentUser); 
     } 
     else { 
      Session.remove('emInspectionUser'); 
     } 
     return response; 
     }, function (error) { 
     if (error.status === 0) { 
      return $q.reject('Could not connect to server.\nPlease check your network connection.'); 
     } 
     else if (error.data.error_description) { 
      return $q.reject(error.data.error_description); 
     } 
     return $q.reject(error.status + ': ' + error.statusText); 
     }); 

Ich bin mit cordova funktioniert App ist und Ich habe Login und Pass, aber ich bin mir nicht sicher, ob mein Login und Pass korrekt sind, und ich kann das aufgrund dieses Fehlers nicht testen.

Antwort

0

Sie Ihr anderes schreiben kann, wenn die Bedingung als

else if (error.data.hasOwnProperty(error_description)) { 
    return $q.reject(error.data.error_description); 
} 
+0

folgen, dass sich nichts ändert –