2016-03-10 26 views
-3

雖然我傳遞正確的用戶名和密碼,但我得到同樣的錯誤。爲什麼我得到的錯誤登錄嘗試失敗,請檢查用戶名和密碼

<html> 
    <head> 
     <meta content="HTML Tidy for Java (vers. 27 Sep 2004), see www.w3.org" name="generator"/> 
     <title/> 
    </head> 
    <body>{"name":"Invalid Login","number":10,"description":"Login attempt failed please check the username and password"}</body> 
</html> 

我給了JSON請求

http://sugarcrmpgsql-shiruslabs.rhcloud.com/service/v4_1/rest.php?rest_data={"user_auth":{"user_name":"admin","password":"admin","version":"1"},"application_name":"SugarCRM REST API","name_value_list":[]}&"input_type"="JSON"&"response_type"="JSON"&"method"="login" 

回答

0

請從phpMyAdmin的更改用戶密碼。

 var params = { 
      user_auth:{ 
       user_name: "ENTER USERNAME", 
       password: "ENTER PASSWORD", 
       encryption: 'PLAIN' 
      }, 
      application: 'RestAPI' 
     } 
     var json = JSON.stringify(params); 

     var loginParam = jQuery.param({ 
      method : "login", 
      input_type : "JSON", 
      response_type : "JSON", 
      rest_data : json 
     }); 

     $http({ 
      url: BASE_URL + 'service/v4_1/rest.php', 
      method: 'POST', 
      dataType: 'JSON', 
      data: loginParam, 
      headers: { 
       'Content-Type': 'application/x-www-form-urlencoded charset=UTF-8' 
      }, 
     }).success(function(response){ 
      if(response.id) 
      { 
       console.log("Success"); 
      } 
      else 
      { 
       alert('Please Enter Correct Username and Password'); 
      } 
     }).error(function(error){ 
      alert('Please Enter Correct Username and Password'); 
     }); 
相關問題